[go: up one dir, main page]

login
a(n) is the smallest number m>n such that the concatenation nm is prime.
5

%I #20 Oct 18 2022 10:45:23

%S 3,3,7,7,9,7,9,9,11,13,17,13,19,23,23,19,21,23,31,27,29,37,33,37,31,

%T 33,29,33,39,37,37,51,43,49,39,37,39,47,43,49,53,43,49,47,47,49,51,61,

%U 51,51,53,61,81,71,57,57,79,61,81,67,63,63,67,69,69,73,79

%N a(n) is the smallest number m>n such that the concatenation nm is prime.

%C Max Alekseyev (see link in A068695) shows that a(n) always exists. - _N. J. A. Sloane_, Nov 13 2020

%C Suggested by the existence question in A228323.

%H Paul Tek, <a href="/A228325/b228325.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>

%e 12 is not prime but 13 is, so a(1)=3.

%e 23 is prime so a(2)=3.

%e 34, 35, 36 are not prime but 37 is, so a(3)=7.

%t smc[n_]:=Module[{m=n+1},If[OddQ[n],m++];While[!PrimeQ[n*10^IntegerLength[ m]+ m],m=m+2];m]; Array[smc,70] (* _Harvey P. Dale_, Apr 30 2016 *)

%o (Python)

%o from sympy import isprime

%o from itertools import count

%o def a(n): return next(k for k in count(n+1) if isprime(int(str(n)+str(k))))

%o print([a(n) for n in range(1, 68)]) # _Michael S. Branicky_, Oct 18 2022

%Y Cf. A228323, A068695.

%K nonn,base

%O 1,1

%A _N. J. A. Sloane_, Aug 20 2013