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

A260869
Least k > 0 such that k^2 + (prime(n)-k)^2 is a prime, or 0 if no such k exists.
3
1, 1, 1, 1, 1, 3, 1, 2, 3, 2, 5, 1, 1, 3, 2, 4, 2, 3, 1, 6, 3, 4, 4, 2, 2, 3, 3, 5, 7, 3, 1, 1, 2, 2, 2, 1, 1, 3, 10, 3, 2, 1, 3, 3, 10, 7, 1, 3, 7, 7, 4, 9, 1, 1, 1, 8, 2, 1, 2, 1, 8, 4, 1, 3, 5, 5, 8, 6, 5, 2, 3, 2, 10, 4, 5, 3, 5, 1, 1, 2, 10, 1, 1, 4, 12, 4, 2, 2, 6, 5, 1, 2, 7, 1, 12, 4, 2
OFFSET
1,6
COMMENTS
It appears that any prime (and also any odd number > 1, see A260870) 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.
LINKS
EXAMPLE
a(n) = A260870((prime(n)-1)/2) for n > 1. - Robert Israel, Oct 10 2024, corrected by M. F. Hasler, Oct 10 2024
MAPLE
f:= proc(n) local p, k;
p:= ithprime(n);
for k from 1 to p do if isprime(k^2 + (p-k)^2) then return k fi od;
0
end proc:
map(f, [$1..100]); # Robert Israel, Oct 10 2024
PROG
(PARI) A260869(n)=for(k=1, (n=prime(n))\2, isprime(k^2+(n-k)^2)&&return(k))
(Python)
from sympy import prime, isprime
def A260869(n):
p = prime(n)
return next((k for k in range(1, (p>>1)+1) if isprime(k**2+(p-k)**2)), 0) # Chai Wah Wu, Oct 14 2024
CROSSREFS
Cf. A260870.
Sequence in context: A305391 A165084 A029279 * A274514 A342932 A026181
KEYWORD
nonn
AUTHOR
M. F. Hasler, Aug 09 2015
EXTENSIONS
Corrected by Robert Israel, Oct 10 2024
STATUS
approved