login
A391054
a(n) = 9*n+1 if n is odd and (n + (n mod 4))/4 if n is even.
3
0, 10, 1, 28, 1, 46, 2, 64, 2, 82, 3, 100, 3, 118, 4, 136, 4, 154, 5, 172, 5, 190, 6, 208, 6, 226, 7, 244, 7, 262, 8, 280, 8, 298, 9, 316, 9, 334, 10, 352, 10, 370, 11, 388, 11, 406, 12, 424, 12, 442, 13, 460, 13, 478, 14, 496, 14, 514, 15, 532, 15, 550, 16, 568
OFFSET
0,2
COMMENTS
Does iterating n -> a(n) always reach 1 (i.e., the cycle 1 -> 10 -> 3 -> 28 -> 7 -> 64 -> 16 -> 4 -> 1)?
FORMULA
a(4*n) = a(4*n-2) for n > 0.
a(2*n+1) = a(2*n-1) + 18 for n > 0.
a(n) = a(n-2) + a(n-4) - a(n-6).
G.f.: (10*x + x^2 + 18*x^3 + 8*x^5) / ((1 - x^2) * (1 - x^4)).
E.g.f.: (-cos(x) + (1 + 36*x)*cosh(x) + (4 + x)*sinh(x))/4. - Stefano Spezia, Nov 26 2025
MATHEMATICA
a[n_] := If[OddQ[n], 9*n + 1, (n + Mod[n, 4])/4]; Array[a, 100, 0] (* Amiram Eldar, Nov 26 2025 *)
PROG
(PARI) a(n) = if(n%2 == 0, (n + n%4)/4, n*9+1)
(Python)
def A391054(n): return 9*n+1 if n&1 else n+(n&3)>>2 # Chai Wah Wu, Nov 28 2025
CROSSREFS
Cf. A006370.
Sequence in context: A050999 A223450 A221311 * A361949 A070246 A085044
KEYWORD
nonn,easy
AUTHOR
Werner Schulte, Nov 26 2025
STATUS
approved