login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A069677 Primes with either no internal digits or all internal digits are 2. 9

%I #31 Aug 28 2021 03:16:20

%S 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,

%T 97,127,223,227,229,421,521,523,727,821,823,827,829,929,1223,1229,

%U 2221,3221,3229,4229,5227,6221,6229,7229,8221,9221,9227,12227,22229,42221

%N Primes with either no internal digits or all internal digits are 2.

%H Michael S. Branicky, <a href="/A069677/b069677.txt">Table of n, a(n) for n = 1..275</a> (1..80 from Harvey P. Dale, 81..178 from David A. Corneth, all terms with <= 1000 digits)

%t Join[Prime[Range[25]],Select[Prime[Range[26,4500]],Union[Most[ Rest[ IntegerDigits[ #]]]] =={2}&]] (* _Harvey P. Dale_, Aug 12 2021 *)

%o (PARI) uptoqdigits(n) = { my(ld = [1,3,7,9]); n = max(n, 2); res = List(primes(primepi(97))); for(i = 1, n-2, twos = 20*(10^i\9); for(j = 1, 9, for(k = 1, #ld, c = j*10^(i+1) + twos + ld[k]; if(isprime(c), listput(res, c) ) ) ) ); Set(res) } \\ _David A. Corneth_, Aug 12 2021

%o (Python)

%o from sympy import isprime

%o def agen(maxdigits):

%o yield from [2, 3, 5, 7]

%o for d in range(2, maxdigits+1):

%o pow10, mid = 10**(d-1), 0 if d < 3 else 10*int('2'*(d-2))

%o cands = (a*pow10+mid+b for a in range(1, 10) for b in [1, 3, 7, 9])

%o yield from filter(isprime, cands)

%o print([an for an in agen(100)]) # _Michael S. Branicky_, Aug 12 2021

%Y Cf. A069675, A069676, A069678, A069679, A069680, A069681, A069682, A069683, A069684.

%K nonn,base

%O 1,1

%A _Amarnath Murthy_, Apr 06 2002

%E Corrected by _Ray Chandler_, Nov 24 2003

%E Offset corrected and name changed by _Arkadiusz Wesolowski_, Sep 07 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 05:26 EDT 2024. Contains 371918 sequences. (Running on oeis4.)