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”).

A030457
Numbers k such that k concatenated with k+1 is prime.
8
2, 6, 8, 12, 36, 42, 50, 56, 62, 68, 78, 80, 90, 92, 96, 102, 108, 120, 126, 138, 150, 156, 180, 186, 188, 192, 200, 216, 242, 246, 252, 270, 276, 278, 300, 308, 312, 318, 330, 338, 342, 350, 362, 368, 378, 390, 402, 410, 416, 420, 426, 428, 432
OFFSET
1,1
COMMENTS
k is not congruent to 1 (mod 2), 1 (mod 3), or 4 (mod 5). - Charles R Greathouse IV, Apr 16 2012
LINKS
EXAMPLE
1213 is prime, therefore 12 is a term.
MAPLE
concat:=proc(a, b) local bb: bb:=nops(convert(b, base, 10)): 10^bb*a+b end proc: a:=proc(n) if isprime(concat(n, n+1))=true then n else end if end proc: seq(a(n), n=0..500); # Emeric Deutsch, Nov 23 2007
MATHEMATICA
Select[ Range[500], PrimeQ[ ToExpression[ StringJoin[ ToString[#], ToString[#+1]]]]&] (* Jean-François Alcover, Nov 18 2011 *)
Select[Range[500], PrimeQ[FromDigits[Join[IntegerDigits[#], IntegerDigits[ #+1]]]]&] (* Harvey P. Dale, Dec 23 2015 *)
Position[#[[1]]*10^IntegerLength[#[[2]]]+#[[2]]&/@Partition[Range[ 500], 2, 1], _?PrimeQ]//Flatten (* Harvey P. Dale, Jul 14 2019 *)
PROG
(Haskell)
a030457 n = a030457_list !! (n-1)
a030457_list = filter ((== 1) . a010051' . a001704) [1..]
-- Reinhard Zumkeller, Jun 27 2015, Apr 26 2011
(PARI) for(n=1, 10^5, if(isprime(eval(concat(Str(n), n+1))), print1(n, ", "))); /* Joerg Arndt, Apr 27 2011 */
(Magma) [n: n in [1..500] | IsPrime(Seqint(Intseq(n+1) cat Intseq(n)))]; // Vincenzo Librandi, Jul 23 2016
(Python)
from sympy import isprime
def ok(n): return isprime(int(str(n)+str(n+1)))
print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Apr 19 2023
CROSSREFS
Cf. A010051, A001704, A068700 (subsequence).
Numbers k such that k concatenated with k+m is prime: this sequence (m=1), A032617 (m=2), A032618 (m=3), A032619 (m=4), A032620 (m=5), A032621 (m=6), A032622 (m=7), A032623 (m=8), A032624 (m=9).
Sequence in context: A226818 A113462 A065392 * A296300 A358970 A224470
KEYWORD
nonn,base,nice
STATUS
approved