OFFSET
1,2
COMMENTS
This is only an empirical observation, but when we graph this sequence, a point always exists at the intersection of y = 2^b and y = -x + 2^(b+1), where b is any integer greater than or equal to 1. This means that a(2^b) = 2^b. This is shown in a link.
Many of the terms seem to be of the form 2^b.
LINKS
FORMULA
a(n) = ((2^n - 1) mod n) + 1 = A082495(n) + 1. - Jon E. Schoenfield, Nov 20 2022
EXAMPLE
For n = 5, with a circular array of positions numbered clockwise from 1 to 5, start at position 1.
On move 1, travel 1 unit clockwise, reaching position 2.
On move 2, travel 2 units clockwise, reaching position 4.
On move 3, travel 4 units clockwise (almost a full circle), reaching position 3.
On move 4, travel 3 units clockwise, reaching position 1.
On move 5, travel 1 unit clockwise, reaching position 2.
Since the final position at the end of the 5th move is 2, a(5) = 2. (See the illustration in the links.)
PROG
(C)
int a(int n)
{
int current = 1;
for (int j = 0; j < n; j++) {
current += current;
if (current > n) {
current = current - n;
}
}
return current;
}
(PARI) a(n) = lift(Mod(2, n)^n - 1) + 1; \\ Kevin Ryde, Nov 20 2022
(Python)
def A357531(n): return m if (m:=pow(2, n, n)) else n # Chai Wah Wu, Dec 01 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Moosa Nasir, Nov 19 2022
STATUS
approved