OFFSET
1,2
REFERENCES
Callaghan, Joseph, John J. Chew III, and Stephen M. Tanny. "On the behavior of a family of meta-Fibonacci sequences." SIAM Journal on Discrete Mathematics 18.4 (2005): 794-824. See T_{0,3} with initial values 0,0,1, and plotted in Fig. 1.5. This is essentially the same sequence. - N. J. A. Sloane, Apr 16 2014
LINKS
C. Deugau and F. Ruskey, Complete k-ary Trees and Generalized Meta-Fibonacci Sequences, J. Integer Seq., Vol. 12. [This is a later version than that in the GenMetaFib.html link]
C. Deugau and F. Ruskey, Complete k-ary Trees and Generalized Meta-Fibonacci Sequences
FORMULA
If n = 1, a(n)=1. If 2 <= n <= 3, then a(n)=n. If n>3 then a(n)=a(n-a(n-1)) + a(n-1-a(n-2)) + a(n-2-a(n-3))
G.f.: A(z) = z / (1 - z) * prod( (1 - z^(3 * [i])) / (1 - z^[i]), i=1..infinity), where [i] = (3^i - 1) / 2.
a(n) = A007844(n)/3. - Michel Marcus, Aug 19 2013, conjectured. This is true: see the analogous sequence A007843 for a sketch of the proof. - M. F. Hasler, Dec 27 2019
MAPLE
a := proc(n)
option remember;
if n <= 1 then return 1 end if;
if n <= 3 then return n end if;
return add(a(n - i + 1 - a(n - i)), i = 1 .. 3)
end proc
MATHEMATICA
a[n_] := a[n] = If[1 <= n <= 3, n, Sum[a[n-i+1 - a[n-i]], {i, 1, 3}]];
Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Aug 02 2022 *)
PROG
(PARI) {a(n)=local(A); if(n<=3, max(0, n), A=vector(n, i, i); for(k=4, n, A[k]=A[k-A[k-1]]+A[k-1-A[k-2]]+A[k-2-A[k-3]]); A[n])} /* Michael Somos, Aug 31 2006 */
(PARI) apply( A120503(n)={my(s=sumdigits(n*=2, 3)\2); n\=3; while(s>0, s-=valuation(n++, 3)+1); n}, [1..99]) \\ M. F. Hasler, Dec 27 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Frank Ruskey and Chris Deugau (deugaucj(AT)uvic.ca), Jun 20 2006
STATUS
approved