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!)
A338715 Smallest prime ending with decimal expansion of n, for n relatively prime to 10. 4

%I #24 Apr 19 2023 21:52:19

%S 11,3,7,19,11,13,17,19,421,23,127,29,31,233,37,139,41,43,47,149,151,

%T 53,157,59,61,163,67,269,71,73,277,79,181,83,487,89,191,193,97,199,

%U 101,103,107,109,2111,113,1117,3119,3121,1123,127,1129,131,4133,137,139,2141,2143,5147,149,151,1153,157

%N Smallest prime ending with decimal expansion of n, for n relatively prime to 10.

%C a(n) exists by Dirichlet's theorem.

%H Robert Israel, <a href="/A338715/b338715.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Pri#piden">Index entries for primes involving decimal expansion of n</a>

%p N:= 100: # for a(1) to a(N)

%p V:= Vector(N):

%p count:= 0:

%p for n from 1 while count < N do

%p if igcd(n,10)=1 then

%p count:= count+1;

%p d:= ilog10(n)+1;

%p for x from n by 10^d do

%p if isprime(x) then V[count]:= x; break fi

%p od

%p fi

%p od:

%p convert(V,list); # _Robert Israel_, Nov 11 2020

%o (Python)

%o from sympy import isprime

%o def a(n):

%o ending = 2*n - 1 + (n+1)//4 * 2 # A045572

%o i, pow10 = ending, 10**len(str(ending))

%o while not isprime(i): i += pow10

%o return i

%o print([a(n) for n in range(1, 64)]) # _Michael S. Branicky_, Nov 03 2021

%Y Cf. A045572, A105888 (base 2 equivalent), A258190.

%Y See A245193, A337834, A338716 for other versions.

%K nonn,base,look

%O 1,1

%A _N. J. A. Sloane_, Nov 11 2020.

%E More terms from _Robert Israel_, Nov 11 2020

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 1 16:01 EDT 2024. Contains 375591 sequences. (Running on oeis4.)