OFFSET
1,3
COMMENTS
The initial occurrences of primes appear in ascending order. After a(1) and a(2), 1's occur only after each such initial occurrence of a prime, followed by that prime's index (in A000040) + 2.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..12580
FORMULA
EXAMPLE
a(1) = 1 by definition.
For n = 2, we see that a(n-1) = a(1) = 1, the sum of whose prime indices is 0, and the only integer k for which A056239(k) = 0 is 1, and 1 occurs once among the terms a(1) .. a(1), thus a(2) = 1 also.
For n = 3, we see that a(n-1) = a(2) = 1 occurs two times among the terms a(1) .. a(2), thus a(3) = 2.
For n = 4, we see that a(n-1) = a(3) = 2, and A056239(2) = 1, and so far there are no other terms than a(3) in a(1) .. a(3) which would result the same sum, thus a(4) = 1.
For n = 5, we see that a(n-1) = a(4) = 1 occurs three times in a(1) .. a(4), thus a(5) = 3.
For n = 6, we see that a(n-1) = a(5) = 3, and A056239(3) = 2 (as 3 = p_2), and so far there are no other terms than a(5) in a(1) .. a(5) which would result the same sum, thus a(6) = 1.
For n = 7, we see that a(n-1) = a(6) = 1 occurs four times in a(1) .. a(6), thus a(7) = 4.
For n = 8, we see that a(n-1) = a(7) = 4, and A056239(4) = 2 (as 4 = p_1 * p_1), and so far among the terms a(1) .. a(7) only a(5) results in the same sum, thus a(8) = 2.
PROG
(PARI)
A049084(n) = if(isprime(n), primepi(n), 0); \\ This function from Charles R Greathouse IV
A249336_write_bfile(up_to_n) = { my(counts, n, a_n); counts = vector(up_to_n); a_n = 1; for(n = 1, up_to_n, write("b249336.txt", n, " ", a_n); counts[1+A056239(a_n)]++; a_n = counts[1+A056239(a_n)]); };
A249336_write_bfile(12580);
(Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Oct 25 2014
STATUS
approved