login
Number of Ramanujan primes less than 10^n.
2

%I #31 Apr 26 2017 22:27:34

%S 1,10,72,559,4459,36960,316066,2760321,24491666,220098288,1998400235,

%T 18299775876,168773875190,1566017986235,14606736768049,

%U 136860923837558,1287462389890262

%N Number of Ramanujan primes less than 10^n.

%t nn=50000; t=Table[0,{nn}]; s=0; Do[If[PrimeQ[k], s++]; If[PrimeQ[k/2], s--]; If[s<nn, t[[s+1]]=k], {k, Prime[3*nn]}]; t=t+1; i=1; Table[While[t[[i]]<10^n, i++]; i-1, {n,Floor[Log[10,t[[-1]]]]}]

%o (Perl) use ntheory ":all"; for my $e (1..9) { say "$e ",scalar(@{ramanujan_primes(10**$e)}); } # _Dana Jacobsen_, May 10 2015

%o # To control memory use at cost of speed:

%o (Perl) use ntheory ":all"; my($n,$inc,$start,$sum)=(1e10,1e9,0,0); while ($start < $n) { $sum += scalar(@{ramanujan_primes($start,$start+$inc-1)}); $start += $inc; } say $sum; # _Dana Jacobsen_, May 10 2015

%o (Perl) use ntheory ":all"; say ramanujan_prime_count(10**$_) for 1..11; # _Dana Jacobsen_, Jan 03 2016

%Y Cf. A104272 (Ramanujan primes).

%Y Cf. A190502 (Number of Ramanujan primes <= 2^n).

%K nonn,more

%O 1,2

%A _T. D. Noe_, Nov 18 2010

%E a(10)-a(11) from _Dana Jacobsen_, Dec 29 2014

%E a(12) from _Dana Jacobsen_, Sep 08 2015

%E a(13)-a(14) from _Dana Jacobsen_, Jan 03 2016

%E a(15)-a(17) from _Dana Jacobsen_, Apr 26 2017