login
A347297
a(1) = 1; for n >= 1, if a(n) is even then a(n+1) = a(n) / 2, otherwise, say a(n) is the k-th odd term in the sequence, a(n+1) = a(n) + k.
2
1, 2, 1, 3, 6, 3, 7, 12, 6, 3, 9, 16, 8, 4, 2, 1, 9, 18, 9, 19, 30, 15, 27, 40, 20, 10, 5, 19, 34, 17, 33, 50, 25, 43, 62, 31, 51, 72, 36, 18, 9, 31, 54, 27, 51, 76, 38, 19, 45, 72, 36, 18, 9, 37, 66, 33, 63, 94, 47, 79, 112, 56, 28, 14, 7, 41, 76, 38, 19, 55
OFFSET
1,2
COMMENTS
This sequence is a variant of A350877; here we add positive integers, there prime numbers.
LINKS
Michael De Vlieger, Annotated log-log scatterplot of a(n), n = 1..2^16, showing records in red, labeling the indices of 1's in blue, appearances of powers of 2 in gold, and terms instigated by even predecessors in green.
EXAMPLE
a(1) = 1.
a(2) = a(1) + 1 = 2 as a(1) is the 1st odd term in the sequence.
a(3) = a(2) / 2 = 1 as a(2) is even.
a(4) = a(3) + 2 = 3 as a(3) is the 2nd odd term in the sequence.
a(5) = a(4) + 3 = 6 as a(4) is the 3rd odd term in the sequence.
MATHEMATICA
j = q = 1; {j}~Join~Reap[Do[If[EvenQ[j], k = j/2, k = j + q; q++]; Sow[k]; j = k, {i, 69}]][[-1, -1]] (* Michael De Vlieger, Jan 24 2022 *)
PROG
(PARI) print1 (v=1); for (k=1, 36, print1 (", "v+=k); while (v%2==0, print1 (", "v/=2)))
CROSSREFS
Sequence in context: A221918 A193897 A226122 * A133904 A245182 A209160
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Jan 23 2022
STATUS
approved