login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Smallest prime ending in 10^n+1 in its base-10 representation.
1

%I #13 May 20 2021 12:46:28

%S 11,101,21001,1810001,2100001,61000001,2010000001,11100000001,

%T 61000000001,1810000000001,14100000000001,151000000000001,

%U 5010000000000001,9100000000000001,271000000000000001,1110000000000000001,24100000000000000001,261000000000000000001,3910000000000000000001,11100000000000000000001

%N Smallest prime ending in 10^n+1 in its base-10 representation.

%H Robert Israel, <a href="/A185949/b185949.txt">Table of n, a(n) for n = 1..995</a>

%p f:= proc(n) local p;

%p for p from 10^n+1 by 10^(n+1) do

%p if isprime(p) then return p fi

%p od

%p end proc:

%p map(f, [$1..30]); # _Robert Israel_, May 03 2018

%t Table[k=0; While[!PrimeQ[p=FromDigits[Join[IntegerDigits[k], IntegerDigits[10^n+1]]]], k++]; p, {n,20}]

%o (Python)

%o from sympy import isprime as is_prime

%o # This implementation assumes function is_prime(n)

%o # returns True if n is prime, or False otherwise:

%o for n in range (1, 100):

%o pattern = 10**n + 1

%o for j in range (0, 10000000):

%o if (j == 0):

%o num = "%d" % (pattern)

%o else:

%o num = "%d%d" % (j, pattern)

%o if (is_prime(num)):

%o print(num)

%o break

%K nonn,base

%O 1,1

%A _Amir H. Farrahi_, Feb 07 2011