OFFSET
0,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
MATHEMATICA
A379057list[nmax_] := Module[{s, a, u = 1}, s[_] := False; s[0] = True; NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || Abs[# - a] <= 1 || !IntegerQ[Sqrt[Abs[# - a]]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0, nmax]];
A379057list[100] (* Paolo Xausa, Mar 21 2025 *)
PROG
(Python)
from math import isqrt
from itertools import count, islice
def cond(n): return n > 1 and isqrt(n)**2 == n
def agen(): # generator of terms
an, aset, m = 0, {0}, 1
for n in count(0):
yield an
an = next(s for k in count(m) for s in [k, -k] if s not in aset and cond(abs(an-s)))
aset.add(an)
while m in aset and -m in aset: m += 1
print(list(islice(agen(), 62))) # Michael S. Branicky, Dec 25 2024
CROSSREFS
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Dec 25 2024
EXTENSIONS
More terms from Michael S. Branicky, Dec 25 2024
STATUS
approved
