login
Primes not containing the digit '9'.
14

%I #53 Aug 04 2023 18:59:12

%S 2,3,5,7,11,13,17,23,31,37,41,43,47,53,61,67,71,73,83,101,103,107,113,

%T 127,131,137,151,157,163,167,173,181,211,223,227,233,241,251,257,263,

%U 271,277,281,283,307,311,313,317,331,337,347,353,367,373,383,401,421

%N Primes not containing the digit '9'.

%C Subsequence of primes of A007095. - _Michel Marcus_, Feb 22 2015

%C Maynard proves that this sequence is infinite and in particular contains the expected number of elements up to x, on the order of x^(log 9/log 10)/log x. - _Charles R Greathouse IV_, Apr 08 2016

%H Indranil Ghosh, <a href="/A038617/b038617.txt">Table of n, a(n) for n = 1..50000</a>

%H M. F. Hasler, <a href="/wiki/Numbers_avoiding_certain_digits">Numbers avoiding certain digits</a>, OEIS wiki, Jan 12 2020.

%H James Maynard, <a href="http://arxiv.org/abs/1604.01041">Primes with restricted digits</a>, arXiv:1604.01041 [math.NT], 2016.

%H James Maynard and Brady Haran, <a href="https://www.youtube.com/watch?v=eeoBCS7IEqs">Primes without a 7</a>, Numberphile video (2019).

%F a(n) ~ n^(log 10/log 9) log n. - _Charles R Greathouse IV_, Aug 03 2023

%t Select[Prime[Range[1000]], DigitCount[ # ][[9]] == 0 &] (* _Stefan Steinerberger_, May 20 2006 *)

%o (Magma) [ p: p in PrimesUpTo(500) | not 9 in Intseq(p) ]; // _Bruno Berselli_, Aug 08 2011

%o (PARI) lista(nn)=forprime(p=2, nn, if (!vecsearch(vecsort(digits(p),,8), 9), print1(p, ", "));); \\ _Michel Marcus_, Feb 22 2015

%o (PARI) lista(nn) = forprime (p=2, nn, if (vecmax(digits(p)) != 9, print1(p, ", "))); \\ _Michel Marcus_, Apr 06 2016

%o (PARI) next_A038617(n)=until((n=nextprime(n+1))==(n=next_A007095(n-1)), ); n \\ _M. F. Hasler_, Jan 14 2020

%o (Python)

%o from sympy import isprime

%o i = 1

%o while i <= 300:

%o if "9" not in str(i) and isprime(i):

%o print(str(i), end=",")

%o i += 1 # _Indranil Ghosh_, Feb 07 2017

%Y Intersection of A000040 (primes) and A007095 (numbers with no digit 9).

%Y Primes having no digit d = 0..9 are A038618, A038603, A038604, A038611, A038612, A038613, A038614, A038615, A038616, and this sequence, respectively.

%Y Primes with other restrictions on digits: A106116, A156756.

%K nonn,easy,base

%O 1,1

%A Vasiliy Danilov (danilovv(AT)usa.net), Jul 15 1998