login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A127356 a(n) is the smallest k > 0 such that k^2 added to prime(n) is prime. 4
1, 2, 6, 2, 6, 2, 6, 2, 6, 12, 4, 2, 24, 2, 6, 6, 18, 6, 2, 6, 4, 2, 12, 12, 2, 6, 2, 12, 2, 6, 2, 6, 6, 10, 12, 4, 4, 2, 12, 12, 18, 4, 6, 2, 6, 8, 4, 2, 6, 2, 6, 12, 4, 24, 6, 18, 18, 6, 2, 6, 8, 18, 2, 6, 2, 6, 4, 4, 6, 2, 6, 12, 4, 4, 2, 6, 30, 2, 24, 10 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

All terms apart from the first need to be even because all primes but the first one have the same parity. Record values 1, 2, 6, 12, 24, 30, 42, 54, 60, 66, 90, 132, 138, 210, 270,... are set at n=1, 2, 3, 10, 13, 77, 92, 152, 294, 484, 517, 964, 1203, 2876, 14118, ... - R. J. Mathar, Apr 02 2007

a(n) exists for all n on the Hardy-Littlewood conjecture F. - Charles R Greathouse IV, Jul 26 2012

LINKS

Zak Seidov, Table of n, a(n) for n = 1..1000

EXAMPLE

17 = prime(7); 17+1^2 = 18, 17+2^2 = 21, 17+3^2 = 26, 17+4^2 = 33, 17+5^2 = 42 are all composite, but 17+6^2 = 53 is prime. Hence a(7) = 6.

MAPLE

a:=proc(n) local A, j: A:={}: for j from 1 to 50 do if isprime(ithprime(n)+j^2)=true then A:=A union {j} else A:=A fi od: A[1]: end: seq(a(n), n=1..120); # Emeric Deutsch, Apr 01 2007

A127356 := proc(n) local p, a; p := ithprime(n) ; a := 1 ; while not isprime(p+a^2) do a := a+1 ; od ; RETURN(a) ; end: for n from 1 to 120 do printf("%d, ", A127356(n)) ; od ; # R. J. Mathar, Apr 02 2007

MATHEMATICA

Join[{1}, Table[p=Prime[n]; x=2; While[!PrimeQ[a=p+x^2], x=x+2]; x, {n, 2, 100}]] (* Zak Seidov, Oct 12 2012 *)

sk[n_]:=Module[{k=2}, While[!PrimeQ[n+k^2], k=k+2]; k]; Join[{1}, Table[sk[n], {n, Prime[Range[2, 80]]}]] (* Harvey P. Dale, Jul 26 2017 *)

PROG

(PARI) {for(n=1, 93, p=prime(n); k=1; while(!isprime(p+k^2), k++); print1(k, ", "))} /* Klaus Brockhaus, Apr 05 2007 */

CROSSREFS

Cf. A000040 (the primes), A000290 (the squares).

Sequence in context: A011325 A010696 A021796 * A232273 A307892 A276152

Adjacent sequences:  A127353 A127354 A127355 * A127357 A127358 A127359

KEYWORD

nonn

AUTHOR

J. M. Bergot, Mar 30 2007

EXTENSIONS

Edited, corrected and extended by Emeric Deutsch, R. J. Mathar and Klaus Brockhaus, Apr 01 2007

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 15 04:34 EDT 2020. Contains 335763 sequences. (Running on oeis4.)