cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A379057 a(0) = 0; thereafter a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference between a(n-1) and a(n) is a square > 1; in case of a tie, preference is given to the positive value.

Original entry on oeis.org

0, 4, -5, -1, 3, -6, -2, 2, 6, -3, 1, 5, -4, -8, 8, 12, -13, -9, 7, 11, -14, -10, 15, 19, 10, 14, -11, -7, 9, 13, -12, -16, 20, 16, -20, -24, -15, -19, 17, 21, 25, 29, 33, 24, -25, -21, -17, -26, -22, -18, 18, 22, 26, -23, -27, -31, -35, -39, -30, 34, 30, -34
Offset: 0

Views

Author

N. J. A. Sloane, Dec 25 2024

Keywords

Comments

Inspired by A377091 and A277616.

Crossrefs

Cf. A277616, A377091, A379058 (first differences), A380313 (partial sums).

Programs

  • 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 *)
  • 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

Extensions

More terms from Michael S. Branicky, Dec 25 2024
Showing 1-1 of 1 results.