[go: up one dir, main page]

login
A339952
Numbers that are the sum of an even square > 0 and an odd square.
2
5, 13, 17, 25, 29, 37, 41, 45, 53, 61, 65, 73, 85, 89, 97, 101, 109, 113, 117, 125, 137, 145, 149, 153, 157, 169, 173, 181, 185, 193, 197, 205, 221, 225, 229, 233, 241, 245, 257, 261, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 333, 337, 349, 353, 365, 369, 373, 377
OFFSET
1,1
EXAMPLE
13 is in the sequence since it is the sum of an even square > 0 and an odd square, 2^2 + 3^2 = 4 + 9 = 13.
MATHEMATICA
Table[If[Sum[Sign[(Mod[i, 2] Mod[n - i + 1, 2] + Mod[i + 1, 2] Mod[n - i, 2])] (Floor[Sqrt[i]] - Floor[Sqrt[i - 1]]) (Floor[Sqrt[n - i]] - Floor[Sqrt[n - i - 1]]), {i, Floor[n/2]}] > 0, n, {}], {n, 500}] // Flatten
PROG
(Python)
def aupto(limit):
m = int(limit**.5) + 2
es = [i*i for i in range(2, m, 2)]
os = [i*i for i in range(1, m, 2)]
return sorted(set(a+b for a in es for b in os if a+b <= limit))
print(aupto(377)) # Michael S. Branicky, May 13 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Dec 24 2020
STATUS
approved