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!)
A065585 Smallest prime beginning with exactly n 2's. 6

%I #23 Mar 03 2021 02:55:51

%S 3,2,223,2221,22229,2222203,22222253,22222223,222222227,22222222273,

%T 22222222223,2222222222243,22222222222201,22222222222229,

%U 222222222222227,222222222222222043,222222222222222281,222222222222222221,22222222222222222253,222222222222222222277

%N Smallest prime beginning with exactly n 2's.

%H M. F. Hasler, <a href="/A065585/b065585.txt">Table of n, a(n) for n = 0..200</a>

%t Do[a = Table[2, {n}]; k = 0; While[b = FromDigits[ Join[a, IntegerDigits[k] ]]; First[ IntegerDigits[k]] == 2 || !PrimeQ[b], k++ ]; Print[b], {n, 1, 17} ]

%o (PARI) A065585(n)={n=10^n\9*2; n>2&for(d=1, 9e9, n*=10; for(t=1, 10^d-1, t\10^(d-1)==2 & t+= 10^(d-1)+(t>2); ispseudoprime(n+t) & return(n+t))); 2+!n} \\ _M. F. Hasler_, Oct 17 2012

%o (Python)

%o from sympy import isprime

%o def a(n):

%o if n < 2: return list([3, 2])[n]

%o n2s, i, pow10, end_digits = int('2'*n), 1, 1, 0

%o while True:

%o i = 1

%o while i < pow10:

%o istr = str(i)

%o if istr[0] == '2' and len(istr) == end_digits:

%o i += pow10 // 10

%o else:

%o t = n2s * pow10 + i

%o if isprime(t): return t

%o i += 2

%o pow10 *= 10; end_digits += 1

%o print([a(n) for n in range(20)]) # _Michael S. Branicky_, Mar 02 2021

%Y Cf. A037057, A065584 - A065592.

%Y A068103 is a lower bound, but most often equality holds. - _M. F. Hasler_, Oct 17 2012

%K nonn,base

%O 0,1

%A _Robert G. Wilson v_, Nov 28 2001

%E Corrected by _Don Reble_, Jan 17 2007

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 September 16 23:59 EDT 2024. Contains 375984 sequences. (Running on oeis4.)