login
A261302
a(n+1) = abs(a(n) - gcd(a(n), 2n+1)), a(1) = 1.
3
1, 0, 5, 4, 3, 2, 1, 0, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 53, 52, 51, 50, 49, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 149, 148, 147, 146, 145, 144, 143
OFFSET
1,3
COMMENTS
The absolute value is relevant only when a(n) = 0, in which case a(n+1) = gcd(a(n), 2n+1) = 2n+1.
It is conjectured that for all n, a(n) = 0 implies that 2n+1 = a(n+1) is prime, cf. A186254. (This is the sequence {u(n)} mentioned there.)
LINKS
EXAMPLE
For n = 1, a(n) = 1 therefore a(n+1) = a(n) - gcd(a(n),2*n+1) = 1 - 1 = 0. The same is true for n = 7.
a(2) = 0 therefore a(3) = gcd(0,2*2+1) = 5, which is prime.
a(3+5) = a(8) = 0 therefore a(9) = gcd(0,2*8+1) = 17, which is also prime.
a(9+17) = a(26) = 0 therefore a(27) = gcd(0,2*26+1) = 53, which is also prime.
a(31) = 49 and 2*31+1 = 63, therefore a(32) = 49 - gcd(49,63) = 49 - 7 = 42. Note that for n = 31+49 = 80, 2n+1 = 161 would not be prime, but for n = 32+42 = 74, 2n+1 = 149 = a(75) is prime.
MATHEMATICA
nxt[{n_, a_}]:={n+1, Abs[a-GCD[a, 2n+1]]}; NestList[nxt, {1, 1}, 80][[All, 2]] (* Harvey P. Dale, Jan 17 2023 *)
PROG
(PARI) print1(a=1); for(n=1, 99, print1(", ", a=abs(a-gcd(a, 2*n+1))))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
M. F. Hasler, Aug 14 2015
STATUS
approved