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”).

A316434
a(n) = a(pi(n)) + a(n-pi(n)) with a(1) = a(2) = 1.
5
1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 11, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 22, 23, 23, 24, 25, 25, 25, 26, 27, 28, 28, 29, 30, 31, 31, 32, 32, 33, 33, 34, 35, 35, 35, 36, 36, 37, 38, 39, 39, 39, 40, 41, 42, 42, 42, 43, 44, 44
OFFSET
1,3
COMMENTS
This sequence hits every positive integer.
LINKS
Altug Alkan, A plot of a(n)/n
Altug Alkan and Orhan Ozgur Aybar, On a Family of Sequences Related to Prime Counting Function, International Journal of Statistics and Probability Vol. 7, No. 6; 2018.
FORMULA
a(n) = a(A000720(n)) + a(A062298(n)) with a(1) = a(2) = 1.
a(n+1) - a(n) = 0 or 1 for all n >= 1.
MAPLE
f:= proc(n) option remember: local p;
p:= numtheory:-pi(n);
procname(p) + procname(n-p)
end proc:
f(1):= 1: f(2):= 1:
map(f, [$1..100]); # Robert Israel, Jul 03 2018
MATHEMATICA
a[1]=a[2]=1; a[n_] := a[n] = a[PrimePi[n]] + a[n - PrimePi[n]]; Array[a, 75] (* Giovanni Resta, Nov 02 2018 *)
PROG
(PARI) q=vector(75); for(n=1, 2, q[n] = 1); for(n=3, #q, q[n] = q[primepi(n)] + q[n-primepi(n)]); q
(C++) See Links section.
(Python)
from sympy import primepi
def A316434(n):
pp = primepi(n)
return 1 if n == 1 or n == 2 else A316434(pp) + A316434(n-pp) # Chai Wah Wu, Nov 02 2018
CROSSREFS
Sequence in context: A086841 A076502 A076897 * A066997 A006165 A078881
KEYWORD
nonn
AUTHOR
Altug Alkan, Jul 02 2018
STATUS
approved