login
Numbers n such that the concatenation n123456789 is prime.
1

%I #33 Sep 08 2022 08:46:06

%S 28,32,41,55,56,59,74,95,100,116,119,122,124,142,154,161,164,179,184,

%T 193,200,215,217,220,230,241,259,265,278,296,298,314,332,382,392,406,

%U 409,416,424,425,439,452,455,458,460,466,475,493,496,514,515,530,536,559,572,574,598,602,613,629,634

%N Numbers n such that the concatenation n123456789 is prime.

%C Numbers n in the primes of the form n987654321 are listed in A232766. Primes in sequence are in A232728.

%e 278 is a member of this sequence because 278123456789 is prime.

%t Select[Range[700], PrimeQ[FromDigits[Flatten[{IntegerDigits[#], IntegerDigits[123456789]}]]] &] (* _Vincenzo Librandi_, Apr 28 2015 *)

%o (Python)

%o from sympy import isprime

%o {print(n,end=', ') for n in range(1,10**3) if isprime(int(str(n)+'123456789'))}

%o ## Simplified by _Derek Orr_, Apr 28 2015

%o (PARI) for(n=1,10^3,if(isprime(eval(concat(Str(n),"123456789"))),print1(n,", "))) \\ _Derek Orr_, Apr 28 2015

%o (Magma) [n: n in [0..700] | IsPrime(Seqint([9..1 by -1] cat Intseq(n)))]; // _Vincenzo Librandi_, Apr 28 2015

%o (Sage) [n for n in (1..700) if is_prime(n*10^9+123456789)] # _Bruno Berselli_, Apr 28 2015

%Y Cf. A104914, A104915, A232728, A232766.

%K nonn,base,easy

%O 1,1

%A _Derek Orr_, Nov 29 2013

%E More terms from _Derek Orr_, Apr 28 2015