A163491 A fractal sequence (if we delete the first occurrence of n we get the sequence itself).
1, 1, 1, 2, 1, 2, 3, 1, 2, 4, 3, 1, 5, 2, 4, 6, 3, 1, 7, 5, 2, 8, 4, 6, 9, 3, 1, 10, 7, 5, 11, 2, 8, 12, 4, 6, 13, 9, 3, 14, 1, 10, 15, 7, 5, 16, 11, 2, 17, 8, 12, 18, 4, 6, 19, 13, 9, 20, 3, 14, 21, 1, 10, 22, 15, 7, 23, 5, 16, 24, 11, 2, 25, 17, 8, 26, 12
Offset: 1
Keywords
Examples
1,_,_,2,_,_,3,_,_,4,... --> 1,1,_,2,_,_,3,_,_,4,... --> 1,1,1,2,_,_,3,_,_,4,... --> 1,1,1,2,1,_,3,_,_,4,... --> 1,1,1,2,1,2,3,_,_,4,... --> 1,1,1,2,1,2,3,_,_,4,... --> 1,1,1,2,1,2,3,1,_,4,... --> 1,1,1,2,1,2,3,1,2,4,... --> ...
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := a[n] = If[Mod[n, 3] == 1, (n+2)/3, a[Floor[2n/3]]]; Array[a, 100] (* Jean-François Alcover, Jan 10 2022 *)
-
PARI
a(n) = n+=2; my(q,r); while([q,r]=divrem(n,3); r, n-=q); q; \\ Kevin Ryde, Jan 16 2021
-
Python
def a(n): return (n+2)//3 if n%3==1 else a(n*2//3) print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Jan 16 2021
Formula
a(3n-2) = n.
From Rémy Sigrist, Jan 15 2021: (Start)
a(n+ceiling(n/2)) = a(n).
a(n) = 1 iff n belongs to A061419.
(End)
a(n) = (n+2)/3 if n == 1 (mod 3), otherwise a(n) = a(floor(n*2/3)). - Michael S. Branicky and Kevin Ryde, Jan 16 2021
Extensions
Terms after a(70) corrected by Jon E. Schoenfield, Nov 26 2015
Comments