Given starting number in sequence, find position of second number
$begingroup$
Given a sequence of numbers $1 - 12$, with starting number $X$ at position $1$, how would you go about finding the position $P$ of number $Y$?
For example, given $X$ = 5 and $Y$ = 4:
The sequence of numbers would be: $[5 6 7 8 9 10 11 12 1 2 3 4]$
So $P = 12$
Or if $X =12$ and $Y = 3$
$[12 1 2 3 4 5 6 7 8 9 10 11]$
$P = 4$
Hopefully this is clear. This is my first SO post, so feedback on formatting etc is welcome.
linear-algebra matrices
$endgroup$
add a comment |
$begingroup$
Given a sequence of numbers $1 - 12$, with starting number $X$ at position $1$, how would you go about finding the position $P$ of number $Y$?
For example, given $X$ = 5 and $Y$ = 4:
The sequence of numbers would be: $[5 6 7 8 9 10 11 12 1 2 3 4]$
So $P = 12$
Or if $X =12$ and $Y = 3$
$[12 1 2 3 4 5 6 7 8 9 10 11]$
$P = 4$
Hopefully this is clear. This is my first SO post, so feedback on formatting etc is welcome.
linear-algebra matrices
$endgroup$
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30
add a comment |
$begingroup$
Given a sequence of numbers $1 - 12$, with starting number $X$ at position $1$, how would you go about finding the position $P$ of number $Y$?
For example, given $X$ = 5 and $Y$ = 4:
The sequence of numbers would be: $[5 6 7 8 9 10 11 12 1 2 3 4]$
So $P = 12$
Or if $X =12$ and $Y = 3$
$[12 1 2 3 4 5 6 7 8 9 10 11]$
$P = 4$
Hopefully this is clear. This is my first SO post, so feedback on formatting etc is welcome.
linear-algebra matrices
$endgroup$
Given a sequence of numbers $1 - 12$, with starting number $X$ at position $1$, how would you go about finding the position $P$ of number $Y$?
For example, given $X$ = 5 and $Y$ = 4:
The sequence of numbers would be: $[5 6 7 8 9 10 11 12 1 2 3 4]$
So $P = 12$
Or if $X =12$ and $Y = 3$
$[12 1 2 3 4 5 6 7 8 9 10 11]$
$P = 4$
Hopefully this is clear. This is my first SO post, so feedback on formatting etc is welcome.
linear-algebra matrices
linear-algebra matrices
edited Jan 24 at 23:19
Faquarl
asked Jan 24 at 23:15
FaquarlFaquarl
11
11
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30
add a comment |
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30
add a comment |
2 Answers
2
active
oldest
votes
$begingroup$
When $Xle Y$:
Let’s find out where 12 is first.
12 will be at (13-X)th place.
That means, Y will be at (13-X+Y)th place.
When $X>Y$:
Then it will just be Y-X+1.
$endgroup$
add a comment |
$begingroup$
If $Y ge X$ then $Y$ is in the $Y-X$ position past $1$. In other words $P = (Y-X) + 1$.
If $Y < X$ then we must go up to $12$ That is $12-X +1=13-X$ and then $Y$ more places $P= 13 - X +Y$
Or, $P = (Y-X) + 1$ if $Y ge X$ or $P = [(Y-X) + 1] + 12$ if $Y < X$.
$endgroup$
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3086506%2fgiven-starting-number-in-sequence-find-position-of-second-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
When $Xle Y$:
Let’s find out where 12 is first.
12 will be at (13-X)th place.
That means, Y will be at (13-X+Y)th place.
When $X>Y$:
Then it will just be Y-X+1.
$endgroup$
add a comment |
$begingroup$
When $Xle Y$:
Let’s find out where 12 is first.
12 will be at (13-X)th place.
That means, Y will be at (13-X+Y)th place.
When $X>Y$:
Then it will just be Y-X+1.
$endgroup$
add a comment |
$begingroup$
When $Xle Y$:
Let’s find out where 12 is first.
12 will be at (13-X)th place.
That means, Y will be at (13-X+Y)th place.
When $X>Y$:
Then it will just be Y-X+1.
$endgroup$
When $Xle Y$:
Let’s find out where 12 is first.
12 will be at (13-X)th place.
That means, Y will be at (13-X+Y)th place.
When $X>Y$:
Then it will just be Y-X+1.
answered Jan 24 at 23:27
Math LoverMath Lover
16010
16010
add a comment |
add a comment |
$begingroup$
If $Y ge X$ then $Y$ is in the $Y-X$ position past $1$. In other words $P = (Y-X) + 1$.
If $Y < X$ then we must go up to $12$ That is $12-X +1=13-X$ and then $Y$ more places $P= 13 - X +Y$
Or, $P = (Y-X) + 1$ if $Y ge X$ or $P = [(Y-X) + 1] + 12$ if $Y < X$.
$endgroup$
add a comment |
$begingroup$
If $Y ge X$ then $Y$ is in the $Y-X$ position past $1$. In other words $P = (Y-X) + 1$.
If $Y < X$ then we must go up to $12$ That is $12-X +1=13-X$ and then $Y$ more places $P= 13 - X +Y$
Or, $P = (Y-X) + 1$ if $Y ge X$ or $P = [(Y-X) + 1] + 12$ if $Y < X$.
$endgroup$
add a comment |
$begingroup$
If $Y ge X$ then $Y$ is in the $Y-X$ position past $1$. In other words $P = (Y-X) + 1$.
If $Y < X$ then we must go up to $12$ That is $12-X +1=13-X$ and then $Y$ more places $P= 13 - X +Y$
Or, $P = (Y-X) + 1$ if $Y ge X$ or $P = [(Y-X) + 1] + 12$ if $Y < X$.
$endgroup$
If $Y ge X$ then $Y$ is in the $Y-X$ position past $1$. In other words $P = (Y-X) + 1$.
If $Y < X$ then we must go up to $12$ That is $12-X +1=13-X$ and then $Y$ more places $P= 13 - X +Y$
Or, $P = (Y-X) + 1$ if $Y ge X$ or $P = [(Y-X) + 1] + 12$ if $Y < X$.
edited Jan 24 at 23:52
Math Lover
16010
16010
answered Jan 24 at 23:28
fleabloodfleablood
72.7k22788
72.7k22788
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3086506%2fgiven-starting-number-in-sequence-find-position-of-second-number%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
$begingroup$
Did you leave "3" out on purpose?
$endgroup$
– Lee Mosher
Jan 24 at 23:18
$begingroup$
"Hopefully this is clear." Not in the slightest.
$endgroup$
– fleablood
Jan 24 at 23:18
$begingroup$
The are the numbers in consecutive order? With $1$ following $12$? If so then that's just $(Y+1) - X$ if $(Y+1)-X > 0$ and $(Y+1) -X+12$ if $(Y+1)-X le 0$.
$endgroup$
– fleablood
Jan 24 at 23:22
$begingroup$
Thanks @fleablood , and apologies for any confusion. I should have mentioned that I have come up with the two separate functions based on the value of Y < > X. I was mostly curious if there is a way to solve for P with one formula.
$endgroup$
– Faquarl
Jan 24 at 23:26
$begingroup$
$P = [(Y+1) - X]% 12$ where $%$ is the remainder function. i.e. if $a = qb +r$ were $r$ is the non-negative remainder then $a% b = r$.
$endgroup$
– fleablood
Jan 24 at 23:30