cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A245727 Least number k >= 0 such that n concatenated with n + k is prime.

This page as a plain text file.
%I A245727 #18 May 22 2025 10:21:39
%S A245727 0,1,4,3,4,1,2,1,2,3,6,1,6,9,8,3,4,5,12,7,8,15,10,13,6,7,2,5,10,7,6,
%T A245727 19,10,15,4,1,2,9,4,9,12,1,6,3,2,3,4,13,2,1,2,9,28,17,2,1,22,3,22,7,2,
%U A245727 1,4,5,4,7,12,1,2,9,6,11,20,3,2,5,12,1,14,1,10,5,4,37,12,3,16,5,10
%N A245727 Least number k >= 0 such that n concatenated with n + k is prime.
%H A245727 Alois P. Heinz, <a href="/A245727/b245727.txt">Table of n, a(n) for n = 1..10000</a>
%F A245727 a(n) = A228325(n) - n for n > 1.
%e A245727 33 is not prime. 34 is not prime. 35 is not prime. 36 is not prime. 37 is prime. Since 7 is 4 more than 3, a(3) = 4.
%p A245727 a:= proc(n) local j; for j from n do if isprime(n*10^(1+ilog10(j))+j) then return(j-n) fi od end proc:
%p A245727 seq(a(n),n=1..100); # _Robert Israel_, Jul 30 2014
%t A245727 lnk[n_]:=Module[{k=0,idn=IntegerDigits[n]},While[!PrimeQ[FromDigits[ Join[ idn, IntegerDigits[ n+k]]]],k++];k]; Array[lnk,90] (* _Harvey P. Dale_, Oct 05 2014 *)
%o A245727 (PARI)
%o A245727 a(n) = for(k=n,10^4,if(isprime(eval(concat(Str(n),Str(k)))),return(k-n)))
%o A245727 vector(150,n,a(n))
%o A245727 (Python)
%o A245727 def a(n):
%o A245727   for k in range(n,10**4):
%o A245727     if isprime(str(n)+str(k)):
%o A245727       return k-n
%o A245727 n = 1
%o A245727 while n < 150:
%o A245727   print(a(n),end=', ')
%o A245727   n += 1
%Y A245727 Cf. A228325.
%K A245727 nonn,base
%O A245727 1,3
%A A245727 _Derek Orr_, Jul 30 2014