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.

A257944 Lexicographically earliest sequence of positive integers such that the terms and their absolute first differences are all distinct and no term is the sum of two distinct terms.

This page as a plain text file.
%I A257944 #19 Dec 23 2024 14:53:44
%S A257944 1,3,7,12,18,26,16,31,20,37,50,22,41,64,35,56,83,39,69,45,54,79,111,
%T A257944 58,92,130,60,96,136,73,115,163,75,121,168,77,134,193,98,149,182,102,
%U A257944 157,206,117,178,244,138,210,277,140,214,282,153,229,307,155,220,263
%N A257944 Lexicographically earliest sequence of positive integers such that the terms and their absolute first differences are all distinct and no term is the sum of two distinct terms.
%C A257944 The sequence of absolute first differences begins: 2, 4, 5, 6, 8, 10, 15, 11, 17, 13, 28, 19, 23, 29, 21, 27, 44, 30, 24, 9, 25, 32, 53, ... .
%H A257944 Alois P. Heinz, <a href="/A257944/b257944.txt">Table of n, a(n) for n = 1..10000</a>
%H A257944 E. Angelini et al., <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2015-May/014848.html">0-additive and first differences</a> and follow-up messages on the SeqFan list, May 13 2015
%p A257944 s:= proc() false end: b:= proc() false end:
%p A257944 a:= proc(n) option remember; local i, k, ok;
%p A257944       if n=1 then b(1):= true; 1
%p A257944     else for k do if b(k) or s(k) or (t-> b(t) or t=k)(
%p A257944            abs(a(n-1)-k)) then next fi; ok:=true;
%p A257944            for i to n-1 while ok do if b(k+a(i))
%p A257944              then ok:=false fi od; if ok then break fi
%p A257944          od;
%p A257944          for i to n-1 do s(a(i)+k):= true od;
%p A257944          b(k), b(abs(a(n-1)-k)):= true$2; k
%p A257944       fi
%p A257944     end:
%p A257944 seq(a(n), n=1..101);
%t A257944 s[_] = False; b[_] = False;
%t A257944 a[n_] := a[n] = Module[{i, k, ok}, If[n == 1, b[1] = True; 1,
%t A257944      For[k = 1, True, k++, If[b[k] || s[k] || Function[t, b[t] ||
%t A257944      t == k][Abs[a[n-1] - k]], Continue[]]; ok = True;
%t A257944              For[i = 1, i <= n-1 && ok, i++, If[b[k + a[i]],
%t A257944              ok = False]]; If[ok, Break[]]];
%t A257944           For[i = 1, i <= n-1, i++, s[a[i] + k] = True];
%t A257944           {b[k], b[Abs[a[n-1] - k]]} = {True, True}; k]];
%t A257944 Table[a[n], {n, 1, 101}] (* _Jean-François Alcover_, Jul 16 2021, after _Alois P. Heinz_ *)
%Y A257944 Cf. A005228, A030124, A095115, A140778, A257941.
%K A257944 nonn,look
%O A257944 1,2
%A A257944 _Eric Angelini_ and _Alois P. Heinz_, May 13 2015