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

A260870
Least k>0 such that k^2 + (2n+1-k)^2 is prime, or 0 if no such k exists.
3
1, 1, 1, 2, 1, 3, 1, 1, 2, 1, 3, 1, 1, 2, 5, 4, 2, 1, 2, 1, 3, 4, 2, 2, 5, 4, 1, 1, 2, 3, 5, 3, 1, 2, 6, 3, 1, 5, 4, 5, 4, 1, 2, 2, 1, 4, 1, 2, 2, 3, 3, 2, 5, 7, 1, 3, 3, 1, 2, 1, 4, 1, 1, 4, 1, 4, 1, 2, 2, 5, 3, 3, 1, 2, 1, 5, 4, 1, 5, 1, 3, 2, 10, 2, 1, 3, 6, 1, 2, 1, 4, 1, 5, 10, 3, 3, 2, 10, 7
OFFSET
1,4
COMMENTS
It appears that any odd number N = 2n+1 > 1 (and also N = 2, hence all primes, see A260869) can be written as the sum of two positive integers such that the sum of their squares is prime. For an even number > 2 this is obviously not possible since k and 2n-k have the same parity and therefore the sum of their squares is even.
The record values 1, 2, 3, 5, 6, 7, 10, 13, 16, 29, 30, 37, 40, 41, 49, 55, 64, 67, 68, 74, 85, 88, 106, 128, ... occur for indices n (half of the odd numbers 2n+1) 1, 4, 6, 15, 35, 54, 83, 121, 172, 281, 936, 1093, 1150, 1240, 3121, 4126, 5116, 6793, 11935, 12556, 18238, 32710, 33343, 57256, ...
LINKS
MATHEMATICA
lk[n_]:=Module[{k=1}, While[!PrimeQ[k^2+(2n+1-k)^2], k++]; k]; Array[lk, 100] (* Harvey P. Dale, May 31 2017 *)
PROG
(PARI) A260870(n)=for(k=1, (n=2*n+1)\2, isprime(k^2+(n-k)^2)&&return(k))
CROSSREFS
Sequence in context: A058564 A226006 A210943 * A282497 A087157 A351094
KEYWORD
nonn
AUTHOR
M. F. Hasler, Aug 09 2015
STATUS
approved