A091709
Number of primes less than 10^n having at least one digit 8.
Original entry on oeis.org
0, 2, 27, 314, 3217, 31699, 308774, 2987107, 28824402, 277779084, 2674980022, 25752370493, 247919235555, 2387154761520
Offset: 1
a(2) = 2 because of the 25 primes less than 10^2, 2 have at least one digit 8.
-
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; c = 0; p = 1; Do[ While[ p = NextPrim[p]; p < 10^n, If[ Position[ IntegerDigits[p], 8] != {}, c++ ]]; Print[c]; p--, {n, 1, 8}] (* Robert G. Wilson v, Feb 02 2004 *)
-
from sympy import sieve # use slower primerange for larger terms
def a(n): return sum('8' in str(p) for p in sieve.primerange(2, 10**n))
print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Apr 23 2021
A091710
Number of primes less than 10^n having at least one digit 9.
Original entry on oeis.org
0, 6, 60, 542, 4826, 43359, 397093, 3677641, 34316162, 321993007, 3035059323, 28710966351, 272413818120, 2591276923548
Offset: 1
a(2) = 6 because of the 25 primes less than 10^2, 6 have at least one digit 9.
-
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; c = 0; p = 1; Do[ While[ p = NextPrim[p]; p < 10^n, If[ Position[ IntegerDigits[p], 9] != {}, c++ ]]; Print[c]; p--, {n, 1, 8}] (* Robert G. Wilson v, Feb 02 2004 *)
A120048
Number of 7-almost primes less than or equal to 10^n.
Original entry on oeis.org
0, 0, 0, 14, 231, 2973, 35585, 409849, 4600247, 50678212, 550454756, 5913771637, 62981797962, 665997804082, 7001087934965, 73232029374751, 762783057783010, 7916319351632036, 81898808371556517
Offset: 0
There are 14 seven-almost primes up to 1000: 128, 192, 288, 320, 432, 448, 480, 648, 672, 704, 720, 800, 832 & 972.
Cf.
A006880,
A036352,
A109251,
A114106,
A114453,
A120047,
A120048,
A120049,
A120050,
A120051,
A120052,
A120053,
A116430.
-
AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
Table[AlmostPrimePi[7, 10^n], {n, 11}]
A120050
Number of 9-almost primes less than or equal to 10^n.
Original entry on oeis.org
0, 0, 0, 2, 47, 671, 8491, 101787, 1180751, 13377156, 148930536, 1636170477, 17787688377, 191742524399, 2052389350029, 21838745177567, 231206458686127, 2437121982958248, 25591920108631224, 267840642082525459
Offset: 0
There are 2 nine-almost primes up to 1000: 512 & 768.
Cf.
A006880,
A036352,
A109251,
A114106,
A114453,
A120047,
A120048,
A120049,
A120050,
A120051,
A120052,
A120053,
A116430.
-
AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
Table[AlmostPrimePi[9, 10^n], {n, 12}]
A120051
Number of 10-almost primes less than or equal to 10^n.
Original entry on oeis.org
0, 0, 0, 0, 22, 306, 4016, 49163, 578154, 6618221, 74342563, 823164388, 9011965866, 97765974368, 1052666075366, 11263041623194, 119864659464824, 1269754732725522, 13396817167474205, 140847445420555406
Offset: 0
There are 22 ten-almost primes up to 10000: 1024, 1536, 2304, 2560, 3456, 3584, 3840, 5184, 5376, 5632, 5760, 6400, 6656, 7776, 8064, 8448, 8640, 8704, 8960, 9600, 9728, and 9984.
Cf.
A006880,
A036352,
A109251,
A114106,
A114453,
A120047,
A120048,
A120049,
A120050,
A120051,
A120052,
A120053,
A116430.
-
AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
Table[AlmostPrimePi[10, 10^n], {n, 12}]
-
from math import isqrt, prod
from sympy import primerange, integer_nthroot, primepi
def A120051(n):
def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b,isqrt(x//c)+1),a)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b,integer_nthroot(x//c,m)[0]+1),a) for d in g(x,a2,b2,c*b2,m-1)))
return int(sum(primepi(10**n//prod(c[1] for c in a))-a[-1][0] for a in g(10**n,0,1,1,10))) # Chai Wah Wu, Nov 03 2024
A120053
Number of 12-almost primes less than or equal to 10^n.
Original entry on oeis.org
0, 0, 0, 0, 3, 63, 865, 11068, 133862, 1563465, 17836903, 200051717, 2214357712, 24255601105, 263439785143, 2841076717752, 30457549169277, 324855769153426, 3449587218984911, 36489283363168885
Offset: 0
There are 3 twelve-almost primes up to 10000: 4096, 6144, and 9216.
Cf.
A006880,
A036352,
A109251,
A114106,
A114453,
A120047,
A120048,
A120049,
A120050,
A120051,
A120052,
A120053,
A116430.
-
AlmostPrimePi[k_Integer, n_] := Module[{a, i}, a[0] = 1; If[k == 1, PrimePi[n], Sum[PrimePi[n/Times @@ Prime[Array[a, k - 1]]] - a[k - 1] + 1, Evaluate[ Sequence @@ Table[{a[i], a[i - 1], PrimePi[(n/Times @@ Prime[Array[a, i - 1]])^(1/(k - i + 1))]}, {i, k - 1}]]]]]; (* Eric W. Weisstein, Feb 07 2006 *)
Table[AlmostPrimePi[12, 10^n], {n, 11}]
-
from math import prod, isqrt
from sympy import primerange, integer_nthroot, primepi
def A120053(n):
def g(x,a,b,c,m): yield from (((d,) for d in enumerate(primerange(b,isqrt(x//c)+1),a)) if m==2 else (((a2,b2),)+d for a2,b2 in enumerate(primerange(b,integer_nthroot(x//c,m)[0]+1),a) for d in g(x,a2,b2,c*b2,m-1)))
return int(sum(primepi(10**n//prod(c[1] for c in a))-a[-1][0] for a in g(10**n,0,1,1,12))) # Chai Wah Wu, Aug 23 2024
A190802
Gauss' approximation for the number of primes below 10^n.
Original entry on oeis.org
5, 29, 177, 1245, 9629, 78627, 664917, 5762208, 50849234, 455055614, 4118066400, 37607950280, 346065645809, 3204942065691, 29844571475287, 279238344248556, 2623557165610821, 24739954309690414, 234057667376222381, 2220819602783663483
Offset: 1
- Jonathan Borwein, David H. Bailey, "Mathematics by Experiment", A. K. Peters, 2004, p. 65 (Table 2.2).
-
seq(round(evalf(integrate(1/log(t),t=2..10^n))), n=1..21);
-
Table[Round[Integrate[1/Log[t],{t,2,10^n}]],{n,20}] (* James C. McMahon, Feb 06 2024 *)
Original entry on oeis.org
1, 7, 34, 193, 1276, 9656, 78562, 664643, 5761519, 50847598
Offset: 0
- Thomas Bloom, Problem 49, Erdős Problems.
- Paul Pollack, Carl Pomerance, and Enrique Treviño, Sets of monotonicity for Euler's totient function, preprint. See M(n).
- Paul Pollack, Carl Pomerance, and Enrique Treviño, Sets of monotonicity for Euler's totient function, Ramanujan J. 30 (2013), no. 3, pp. 379-398.
- Terence Tao, Monotone non-decreasing sequences of the Euler totient function, arXiv:2309.02325 [math.NT], 2023.
- Terence Tao, Erdős problem database, see no. 49.
-
from bisect import bisect
from sympy import totient
def A365474(n):
m = 10**n
plist, qlist, c = tuple(totient(i) for i in range(1,m+1)), [0]*(m+1), 0
for i in range(m):
qlist[a:=bisect(qlist,plist[i],lo=1,hi=c+1,key=lambda x:plist[x])]=i
c = max(c,a)
return c
A040014
Number of primes < e^n.
Original entry on oeis.org
0, 1, 4, 8, 16, 34, 79, 183, 429, 1019, 2466, 6048, 14912, 37128, 93117, 234855, 595341, 1516233, 3877186, 9950346, 25614562, 66124777, 171141897, 443963543, 1154106844, 3005936865, 7842921261, 20496470801, 53645077679, 140599114669, 368973074565, 969455391690, 2550043255883
Offset: 0
-
a040014 = a000720 . a000149 -- Reinhard Zumkeller, Mar 17 2015
-
Table[PrimePi[Exp[n]], {n, 0, 33}]
A073532
Number of n-digit primes with all digits distinct.
Original entry on oeis.org
4, 20, 97, 510, 2529, 10239, 33950, 90510, 145227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1
a(3)=97 because there are 97 three-digit primes with distinct digits: 103, 107, 109, 127, 137, 139, 149, 157, 163, 167, 173, 179, 193, 197,239, 241, 251, 257, 263, 269, 271, 281, 283, 293,307, 317, 347, 349, 359, 367, 379, 389, 397, 401, 409, 419, 421, 431, 439, 457, 461, 463, 467, 479, 487, 491, 503, 509, 521, 523, 541, 547, 563, 569, 571, 587, 593, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 673, 683, 691, 701, 709, 719, 739, 743, 751, 761, 769, 809, 821, 823, 827, 829, 839, 853, 857, 859, 863, 907, 937, 941, 947, 953, 967, 971, 983.
-
lst = {}; Do[p = Prime@ n; If[ Union[Length /@ Split@ Sort@ IntegerDigits@ p] == {1}, AppendTo[lst, p]], {n, PrimePi[10^9]}]; Table[ Length@ Select[lst, 10^n < # < 10^(n + 1) &], {n, 0, 9}] (* Robert G. Wilson v, Jul 25 2008 *)
-
from itertools import permutations
from sympy import isprime, primerange
def distinct_digs(n): s = str(n); return len(s) == len(set(s))
def a(n):
if n >= 10: return 0
return sum(isprime(int("".join(p))) for p in permutations("0123456789", n) if p[0] != '0')
print([a(n) for n in range(1, 31)]) # Michael S. Branicky, Apr 20 2021
Comments