login
A345877
a(1) = 1, a(n) = a(n-1)/2 if a(n-1) is even, otherwise a(n) = n - a(n-1).
2
1, 1, 2, 1, 4, 2, 1, 7, 2, 1, 10, 5, 8, 4, 2, 1, 16, 8, 4, 2, 1, 21, 2, 1, 24, 12, 6, 3, 26, 13, 18, 9, 24, 12, 6, 3, 34, 17, 22, 11, 30, 15, 28, 14, 7, 39, 8, 4, 2, 1, 50, 25, 28, 14, 7, 49, 8, 4, 2, 1, 60, 30, 15, 49, 16, 8, 4, 2, 1, 69, 2, 1, 72, 36, 18, 9, 68, 34, 17, 63, 18, 9, 74, 37, 48, 24, 12, 6, 3
OFFSET
1,3
COMMENTS
Let a_i(1) = 1 and a_i(n) = a_i(n-1)/(i+1) if a_i(n-1) is divisible by i+1, otherwise a_i(n) = n - a_i(n-1). This sequence is a_1(n) and A345886 is a_2(n).
Conjecture: a_i(n) hits every positive integers infinitely many times for all i >= 1.
LINKS
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[EvenQ[a[n - 1]], a[n - 1]/2, n - a[n - 1]]; Array[a, 100] (* Amiram Eldar, Jun 29 2021 *)
nxt[{n_, a_}]:={n+1, If[EvenQ[a], a/2, n+1-a]}; NestList[nxt, {1, 1}, 90][[;; , 2]] (* Harvey P. Dale, Aug 31 2023 *)
PROG
(PARI) q=vector(100); q[1]=1; for(n=2, #q, q[n] = if(q[n-1]%2, n-q[n-1], q[n-1]/2)); q
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 28 2021
STATUS
approved