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!)
A240131 Least k such that prime(n)^2 + k^2 is prime, or 0 if none. 7
1, 2, 2, 2, 4, 2, 2, 6, 8, 4, 4, 2, 4, 8, 2, 10, 6, 10, 2, 6, 2, 4, 18, 4, 2, 10, 2, 10, 4, 18, 8, 16, 2, 10, 14, 4, 10, 2, 2, 10, 4, 6, 4, 2, 8, 16, 4, 18, 8, 4, 2, 10, 16, 14, 18, 8, 10, 6, 2, 4, 8, 2, 2, 4, 2, 2, 6, 20, 2, 14, 8, 10, 8, 2, 6, 12, 4, 18, 4, 6, 14, 4, 6, 12, 4, 28, 10, 12, 6, 2, 12, 14, 2, 6, 4, 2, 14, 14, 10, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
The main entry for this sequence is A240130.
k and p_n must be of opposite parity. Conjecture, there is always a k for any p_n. Tested for all primes < 15*10^10. - Robert G. Wilson v, Nov 04 2015
Least k > 0 for which prime(n)+i*k is a Gaussian prime. - Robert Israel, Nov 04 2015
LINKS
FORMULA
a(n)^2 = A240130(n) - prime(n)^2 if a(n) > 0.
EXAMPLE
Prime(3) = 5 and 5^2 + 1^2 = 26 is not prime but 5^2 + 2^2 = 29 is prime, so a(3) = 2.
MAPLE
f:= proc(p) local k; for k from 2 by 2 do if isprime(p^2 + k^2) then return k fi eod nd proc:
f(2):= 1:
map(f, select(isprime, [2, seq(2*i+1, i=1..10000)])); # Robert Israel, Nov 04 2015
MATHEMATICA
f[n_] := Block[{k = If[n == 1, 1, 2], p = Prime@ n}, While[ !PrimeQ[k^2 + p^2], k += 2]; k]; Array[f, 100] (* Robert G. Wilson v, Nov 03 2015 *)
lk[n_]:=Module[{k=2, n2=n^2}, While[!PrimeQ[n2+k^2], k+=2]; k]; Join[{1}, Table[ lk[x], {x, Prime[Range[2, 100]]}]] (* Harvey P. Dale, Mar 22 2019 *)
PROG
(PARI) vector(100, n, p = prime(n); k = 1 - p%2; inc = 2; while (!isprime(q=p^2+k^2), k += inc); k; ) \\ Altug Alkan, Nov 04 2015
CROSSREFS
Cf. A240130.
Sequence in context: A345530 A216955 A086973 * A029640 A029658 A332889
KEYWORD
nonn
AUTHOR
Jonathan Sondow, Apr 07 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 April 20 00:58 EDT 2024. Contains 371798 sequences. (Running on oeis4.)