login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A083417
Primitive recursive function r(z, r(s, r(s, r(s, p_2)))) at (n, 0).
2
0, 1, 2, 1, 0, 5, 2, 3, 3, 2, 2, 3, 4, 1, 8, 5, 4, 2, 2, 3, 3, 2, 2, 7, 2, 9, 5, 2, 12, 9, 7, 5, 4, 2, 2, 3, 4, 1, 8, 5, 4, 2, 2, 3, 3, 2, 2, 15, 8, 5, 1, 43, 20, 13, 10, 3, 14, 7, 3, 11, 8, 3, 8, 5, 4, 2, 2, 3, 4, 1, 24, 13, 5, 4, 2, 11, 4, 5, 5, 4, 1, 13, 6, 5, 5, 4, 2, 7, 5, 3, 1, 3, 3, 2, 2, 31, 14, 10, 3
OFFSET
0,3
REFERENCES
S. Wolfram, A New Kind of Science, 2001, p. 908.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
S. Wolfram, A New Kind of Science, pages 907-908.
MAPLE
z := x -> 0: s := x -> (1 + op(1, x)): p := x -> subs(q = x, y -> op(q, y)): c := x -> subs(q = x, y -> eval((op(1, q))([(seq(op(i, q), i = 2..nops(q)))(y)]))): r := x -> subs(q = x, y -> eval(`if`(op(1, y) = 0, (op(1, q))([op(2, y)]), (op(2, q))([r(q)([op(1, y) - 1, op(2, y)]), op(1, y) - 1, op(2, y)])))): seq(r([z, r([s, r([s, r([s, p(2)])])])])([i, 0]), i = 0..109);
MATHEMATICA
(Mathematica code from New Kind of Science, p. 908, added by N. J. A. Sloane, Feb 17 2015)
F = Fold[Fold[
2^Ceiling[Log[2, Ceiling[(#1 + 2)/(#2 + 2)]]] (#2 + 2) -
2 - #1 &, #2, Range[#1]] &, 0, Range[#]] &
Table[F[n], {n, 0, 500}]
PROG
(PARI) f(x, y)=(y+2)<<ceil(log(ceil((x+2)/(y+2)))/log(2))-2-x
a(n)=my(t, y); for(k=1, n, y=k; for(i=1, t, y=f(y, i)); t=y); t
A(n)=my(v=vector(n), t, y); v[1]=1; for(k=2, n, y=k; for(i=1, t, y=f(y, i)); v[k]=t=y); v \\ Charles R Greathouse IV, Jan 25 2012
CROSSREFS
A253099 gives locations of zeros.
Sequence in context: A103185 A130513 A114596 * A021479 A073583 A324162
KEYWORD
nonn
AUTHOR
Alex Fink, Jun 08 2003
STATUS
approved