Determining the values for an array within limits












0












$begingroup$


So I did some math on a function to produce positions within an array of which I wanted to record data. My initial math looked like this:



$$ (n * frac{100}{n})-1$$



This would allow me to determine the upper limit of the array, and then I could capture the data in each position of that multiple...



ex if $n = 7$:
The first array set of values would be 0, 7, 14, 21...98
The second array 1, 8, 15, 22...99
The third 2, 9, 16, 23...93



What I was trying to do was determine the max multiple of $n$ in 0-99. This worked for the values that we were initially given. $n$ could have been 7 or 8. Now, the customer has requested that the value range be 5 to 8. This produced a signifigant problem because the result of the above formula became 100 when $n$ was 5. The array upper bounds is 99, so we can't use the value of 100. How can I change the formula so that it can be an all in one solution and we don't have to worry about limits? Basically, the value produced should be the greatest multiple of $n$ that is 99 or less, minus 1.



Ex:



$n=8$ should produce a value of 95 $8*12-1$



$n=7$ should produce a value of 97 $7*14-1$



$n=6$ should produce a value of 95 $6*16-1$



$n=5$ should produce a value of 99 $5*20-1$



$n=4$ should produce a value of 95 $4*24-1$










share|cite|improve this question











$endgroup$












  • $begingroup$
    Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
    $endgroup$
    – Martund
    Dec 8 '18 at 10:24










  • $begingroup$
    @Crazyformaths done, thanks.
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:30
















0












$begingroup$


So I did some math on a function to produce positions within an array of which I wanted to record data. My initial math looked like this:



$$ (n * frac{100}{n})-1$$



This would allow me to determine the upper limit of the array, and then I could capture the data in each position of that multiple...



ex if $n = 7$:
The first array set of values would be 0, 7, 14, 21...98
The second array 1, 8, 15, 22...99
The third 2, 9, 16, 23...93



What I was trying to do was determine the max multiple of $n$ in 0-99. This worked for the values that we were initially given. $n$ could have been 7 or 8. Now, the customer has requested that the value range be 5 to 8. This produced a signifigant problem because the result of the above formula became 100 when $n$ was 5. The array upper bounds is 99, so we can't use the value of 100. How can I change the formula so that it can be an all in one solution and we don't have to worry about limits? Basically, the value produced should be the greatest multiple of $n$ that is 99 or less, minus 1.



Ex:



$n=8$ should produce a value of 95 $8*12-1$



$n=7$ should produce a value of 97 $7*14-1$



$n=6$ should produce a value of 95 $6*16-1$



$n=5$ should produce a value of 99 $5*20-1$



$n=4$ should produce a value of 95 $4*24-1$










share|cite|improve this question











$endgroup$












  • $begingroup$
    Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
    $endgroup$
    – Martund
    Dec 8 '18 at 10:24










  • $begingroup$
    @Crazyformaths done, thanks.
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:30














0












0








0





$begingroup$


So I did some math on a function to produce positions within an array of which I wanted to record data. My initial math looked like this:



$$ (n * frac{100}{n})-1$$



This would allow me to determine the upper limit of the array, and then I could capture the data in each position of that multiple...



ex if $n = 7$:
The first array set of values would be 0, 7, 14, 21...98
The second array 1, 8, 15, 22...99
The third 2, 9, 16, 23...93



What I was trying to do was determine the max multiple of $n$ in 0-99. This worked for the values that we were initially given. $n$ could have been 7 or 8. Now, the customer has requested that the value range be 5 to 8. This produced a signifigant problem because the result of the above formula became 100 when $n$ was 5. The array upper bounds is 99, so we can't use the value of 100. How can I change the formula so that it can be an all in one solution and we don't have to worry about limits? Basically, the value produced should be the greatest multiple of $n$ that is 99 or less, minus 1.



Ex:



$n=8$ should produce a value of 95 $8*12-1$



$n=7$ should produce a value of 97 $7*14-1$



$n=6$ should produce a value of 95 $6*16-1$



$n=5$ should produce a value of 99 $5*20-1$



$n=4$ should produce a value of 95 $4*24-1$










share|cite|improve this question











$endgroup$




So I did some math on a function to produce positions within an array of which I wanted to record data. My initial math looked like this:



$$ (n * frac{100}{n})-1$$



This would allow me to determine the upper limit of the array, and then I could capture the data in each position of that multiple...



ex if $n = 7$:
The first array set of values would be 0, 7, 14, 21...98
The second array 1, 8, 15, 22...99
The third 2, 9, 16, 23...93



What I was trying to do was determine the max multiple of $n$ in 0-99. This worked for the values that we were initially given. $n$ could have been 7 or 8. Now, the customer has requested that the value range be 5 to 8. This produced a signifigant problem because the result of the above formula became 100 when $n$ was 5. The array upper bounds is 99, so we can't use the value of 100. How can I change the formula so that it can be an all in one solution and we don't have to worry about limits? Basically, the value produced should be the greatest multiple of $n$ that is 99 or less, minus 1.



Ex:



$n=8$ should produce a value of 95 $8*12-1$



$n=7$ should produce a value of 97 $7*14-1$



$n=6$ should produce a value of 95 $6*16-1$



$n=5$ should produce a value of 99 $5*20-1$



$n=4$ should produce a value of 95 $4*24-1$







recreational-mathematics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 8 '18 at 10:48







Jaberwocky

















asked Dec 8 '18 at 10:18









JaberwockyJaberwocky

1055




1055












  • $begingroup$
    Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
    $endgroup$
    – Martund
    Dec 8 '18 at 10:24










  • $begingroup$
    @Crazyformaths done, thanks.
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:30


















  • $begingroup$
    Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
    $endgroup$
    – Martund
    Dec 8 '18 at 10:24










  • $begingroup$
    @Crazyformaths done, thanks.
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:30
















$begingroup$
Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
$endgroup$
– Martund
Dec 8 '18 at 10:24




$begingroup$
Please recheck your calculations: 95 = 8*12-1 and 95 = 6*16-1.
$endgroup$
– Martund
Dec 8 '18 at 10:24












$begingroup$
@Crazyformaths done, thanks.
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:30




$begingroup$
@Crazyformaths done, thanks.
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:30










1 Answer
1






active

oldest

votes


















1












$begingroup$

The maximum multiple of a number in $0-99$ is given by $Big[frac{99}{n}Big]times n$ (where [.] is the greatest integer function).



Hope it is helpful:)






share|cite|improve this answer









$endgroup$













  • $begingroup$
    So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:35










  • $begingroup$
    Uhg, you're right. Don't know how I missed that. Thanks!
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:43











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3030920%2fdetermining-the-values-for-an-array-within-limits%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1












$begingroup$

The maximum multiple of a number in $0-99$ is given by $Big[frac{99}{n}Big]times n$ (where [.] is the greatest integer function).



Hope it is helpful:)






share|cite|improve this answer









$endgroup$













  • $begingroup$
    So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:35










  • $begingroup$
    Uhg, you're right. Don't know how I missed that. Thanks!
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:43
















1












$begingroup$

The maximum multiple of a number in $0-99$ is given by $Big[frac{99}{n}Big]times n$ (where [.] is the greatest integer function).



Hope it is helpful:)






share|cite|improve this answer









$endgroup$













  • $begingroup$
    So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:35










  • $begingroup$
    Uhg, you're right. Don't know how I missed that. Thanks!
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:43














1












1








1





$begingroup$

The maximum multiple of a number in $0-99$ is given by $Big[frac{99}{n}Big]times n$ (where [.] is the greatest integer function).



Hope it is helpful:)






share|cite|improve this answer









$endgroup$



The maximum multiple of a number in $0-99$ is given by $Big[frac{99}{n}Big]times n$ (where [.] is the greatest integer function).



Hope it is helpful:)







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Dec 8 '18 at 10:31









MartundMartund

1,633213




1,633213












  • $begingroup$
    So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:35










  • $begingroup$
    Uhg, you're right. Don't know how I missed that. Thanks!
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:43


















  • $begingroup$
    So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:35










  • $begingroup$
    Uhg, you're right. Don't know how I missed that. Thanks!
    $endgroup$
    – Jaberwocky
    Dec 8 '18 at 10:43
















$begingroup$
So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:35




$begingroup$
So basically you're telling me if I didn't over complicate the firsts formula, I wouldn't be having this problem? :P
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:35












$begingroup$
Uhg, you're right. Don't know how I missed that. Thanks!
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:43




$begingroup$
Uhg, you're right. Don't know how I missed that. Thanks!
$endgroup$
– Jaberwocky
Dec 8 '18 at 10:43


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3030920%2fdetermining-the-values-for-an-array-within-limits%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...