VOOZH about

URL: https://oeis.org/A391207

⇱ A391207 - OEIS


login
A391207
The smallest nonnegative integer k such that n + k is not a sum of two squares.
0
2, 1, 0, 2, 1, 0, 0, 3, 2, 1, 0, 0, 1, 0, 0, 3, 2, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 2, 1, 0, 0, 2, 1, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 3, 2, 1, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 1, 0, 0
OFFSET
1,1
COMMENTS
The value of a(n) is at most 3 since among 4 consecutive integers there is one congruent 3 modulo 4 and no such number is a sum of two squares.
PROG
(PARI) isSumOfTwoSquares(n) = { my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2] % 2 && f[i, 1] % 4 == 3, return(0))); 1 }
a(n) = { my(r=0); while(isSumOfTwoSquares(n+r), r=r+1); r }
CROSSREFS
Sequence in context: A320658 A284966 A143540 * A291336 A208664 A030200
KEYWORD
nonn
AUTHOR
Peter Schorn, Dec 03 2025
STATUS
approved