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.

A383442 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 triangular number; in case of a tie, preference is given to the positive value.

This page as a plain text file.
%I A383442 #33 May 05 2025 11:45:30
%S A383442 0,1,2,-1,-2,-3,3,4,5,-5,-4,6,7,8,-7,-6,9,10,11,-10,-9,-8,-11,-12,-13,
%T A383442 -14,14,13,12,15,16,17,18,-18,-15,-16,-17,19,20,21,22,23,-22,-19,-20,
%U A383442 -21,24,25,26,27,28,-27,-24,-23,-26,-25,-28,-29,-30,-31,-32,-33,33,30,29,32,31,34,35,36,37,38,39,-39,-36,-35,-34,-37,-38,40
%N A383442 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 triangular number; in case of a tie, preference is given to the positive value.
%C A383442 Heraclitus (circa 500 BCE) observed that no man can step in the same river twice.
%C A383442 The Heraclitus transform H(S) of a sequence S is formed by starting at 0, and moving s steps to the left or right, where s is any element of S, never visiting any number twice, and moving as close to 0 as possible. In case of a tie, move to the positive term.
%C A383442 The present sequence is the Heraclitus transform of the triangular numbers A000217.  For the squares, see A377091. Conjecture: both H(A000217) and H(A000290) contain every (positive or negative) integer. In fact it appears that this property holds whenever S is a monotonically strictly increasing sequence starting with 1. It does not hold for H(A000012), which is A001477.
%H A383442 Michael S. Branicky, <a href="/A383442/b383442.txt">Table of n, a(n) for n = 0..20000</a>
%t A383442 A383442list[nmax_] := Module[{s, a, u = 1}, s[_] := False; s[0] = True; NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || !IntegerQ[Sqrt[8*Abs[# - a]+1]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0, nmax]];
%t A383442 A383442list[100] (* _Paolo Xausa_, May 05 2025 *)
%o A383442 (Python)
%o A383442 from math import isqrt
%o A383442 from itertools import count, islice
%o A383442 def cond(n): return isqrt(m:=8*n+1)**2 == m
%o A383442 def agen(): # generator of terms
%o A383442     an, aset, m = 0, {0}, 1
%o A383442     for n in count(0):
%o A383442         yield an
%o A383442         an = next(s for k in count(m) for s in [k, -k] if s not in aset and cond(abs(an-s)))
%o A383442         aset.add(an)
%o A383442         while m in aset and -m in aset: m += 1
%o A383442 print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 03 2025
%Y A383442 Cf. A000217, A000290, A001477, A377091, A383443, A383688.
%K A383442 sign
%O A383442 0,3
%A A383442 _N. J. A. Sloane_, May 03 2025