[go: up one dir, main page]

login
A371905
Let k = 0 and let A007814(2*n) = m; If m > k then a(n) = k = k + m, otherwise a(n) = k = k - m.
2
1, 3, 2, 5, 4, 2, 1, 5, 4, 2, 1, 4, 3, 1, 0, 5, 4, 2, 1, 4, 3, 1, 0, 4, 3, 1, 0, 3, 2, 0, 1, 7, 6, 4, 3, 0, 1, 3, 2, 6, 5, 3, 2, 5, 4, 2, 1, 6, 5, 3, 2, 5, 4, 2, 1, 5, 4, 2, 1, 4, 3, 1, 0, 7, 6, 4, 3, 0, 1, 3, 2, 6, 5, 3, 2, 5, 4, 2, 1, 6, 5, 3, 2, 5, 4, 2, 1
OFFSET
1,2
LINKS
EXAMPLE
Let f(x) = A007814(x).
a(1) = 1 because k = 0 and f(2*1) = 1; since 0 < 1, a(1) = k = 0 + 1 = 1.
a(2) = 3 because k = 1 and f(2*2) = 2; since 1 < 2, a(2) = k = 1 + 2 = 3.
a(3) = 2 because k = 3 and f(2*3) = 1; since 3 > 2, a(3) = k = 3 - 1 = 2, etc.
MATHEMATICA
nn = 120; k = 0; q = 2; Reap[Do[If[k < #, k += #, k -= #] &@ IntegerExponent[q*n, q]; Sow[k], {n, nn}]][[-1, 1]]
CROSSREFS
Cf. A007814.
Sequence in context: A210714 A343782 A363447 * A371908 A143956 A110661
KEYWORD
nonn,easy
AUTHOR
Michael De Vlieger, Apr 11 2024
STATUS
approved