OFFSET
1,3
COMMENTS
Let A be A007504. The number of distinct values of k such that a(k)=r is the number of primes p in the interval A(r) <= p < A(r+1); namely: 2,2,2,3,3,4,5,4,6,6,... (see A323701). Let b(n) be the smallest r such that a(r)=n, namely: 1,3,5,7,10,13,17,22,26,... For given n, if k is the index of the smallest prime >= A(n), then b(n)=k. (The equality applies when n is a term of A013916.)
EXAMPLE
PROG
(Perl) use ntheory ':all'; sub a { my $p = nth_prime($_[0]); my($s, $q) = (0, 2); while ($s <= $p) { $s += $q; $q = next_prime($q) }; prime_count($q-1)-1 }; print join(", ", map { a($_) } 1..100), "\n"; # Daniel Suteu, Jan 26 2019
(PARI) a(n) = my(k=0, p=0, s=0); while(s <= prime(n), k++; p=nextprime(p+1); s+=p); k-1; \\ Michel Marcus, Feb 19 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Nov 12 2018
STATUS
approved