OFFSET
1,2
COMMENTS
If n = 1, the result is 1, otherwise, if n is prime, compute the result for that prime's index (A000720 or A049084) and add one, and if n is composite, compute the result for that composite's index (A065855) and add one.
a(n) tells how many calls (including the toplevel call) are required to compute A135141(n) or A246377(n) with a simple (nonmemoized) recursive algorithm as employed for example by Robert G. Wilson v's Mathematica-program of Feb 16 2008 in A135141 or Antti Karttunen's Scheme-proram in A246377.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..32998
FORMULA
a(1) = 1, and for n >= 1, if A010051(n)=1 [that is, when n is prime], a(n) = 1 + a(A000720(n)), otherwise a(n) = 1 + a(A065855(n)). [A000720(n) and A065855(n) tell the number of primes, and respectively, composites <= n].
PROG
(PARI)
\\ Compute the b-files for both the positions of records (A246346) and their values (A246347) and also for A246348 (somewhat naively):
default(primelimit, (2^31)+(2^30));
A070939 = n->#binary(n)+!n \\ From M. F. Hasler
prevmax = -1; i = 0; for(n=1, 123456, if((k=A135141(n)) > prevmax, prevmax = k; i++; write("b246346.txt", i, " ", n); write("b246347.txt", i, " ", k)); write("b246348.txt", n, " ", A246348(n)));
(Scheme, two versions, second being a direct recurrence employing memoizing definec-macro from Antti Karttunen's IntSeq-library)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 27 2014
STATUS
approved