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!)
A245727 Least number k >= 0 such that n concatenated with n + k is prime. 1
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
FORMULA
a(n) = A228325(n) - n for n > 1.
EXAMPLE
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.
MAPLE
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:
seq(a(n), n=1..100); # Robert Israel, Jul 30 2014
MATHEMATICA
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 *)
PROG
(PARI)
a(n) = for(k=n, 10^4, if(isprime(eval(concat(Str(n), Str(k)))), return(k-n)))
vector(150, n, a(n))
(Python)
def a(n):
..for k in range(n, 10**4):
....if isprime(str(n)+str(k)):
......return k-n
n = 1
while n < 150:
..print(a(n), end=', ')
..n += 1
CROSSREFS
Cf. A228325.
Sequence in context: A066340 A195597 A143505 * A280822 A346785 A284517
KEYWORD
nonn,base
AUTHOR
Derek Orr, Jul 30 2014
STATUS
approved

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 March 28 04:55 EDT 2024. Contains 371235 sequences. (Running on oeis4.)