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.

A257941 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 earlier terms.

This page as a plain text file.
%I A257941 #20 Feb 16 2025 08:33:25
%S A257941 1,3,7,12,18,26,9,20,34,24,39,55,22,45,66,28,47,72,85,49,76,108,68,99,
%T A257941 53,82,112,70,114,149,74,122,172,93,145,203,101,160,95,162,216,118,
%U A257941 187,224,141,214,143,235,139,195,281,164,241,329,166,260,170,283,168
%N A257941 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 earlier terms.
%C A257941 The sequence of absolute first differences begins: 2, 4, 5, 6, 8, 17, 11, 14, 10, 15, 16, 33, 23, 21, 38, 19, 25, 13, 36, 27, 32, 40, ... .
%C A257941 The sequence is 0-additive.
%H A257941 Alois P. Heinz, <a href="/A257941/b257941.txt">Table of n, a(n) for n = 1..10000</a>
%H A257941 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
%H A257941 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/s-AdditiveSequence.html">s-Additive Sequence</a>
%p A257941 s:= proc() false end: b:= proc() false end:
%p A257941 a:= proc(n) option remember; local i, k;
%p A257941       if n=1 then b(1):= true; 1
%p A257941     else for k while b(k) or s(k) or
%p A257941          (t-> b(t) or t=k)(abs(a(n-1)-k)) do od;
%p A257941          for i to n-1 do s(a(i)+k):= true od;
%p A257941          b(k), b(abs(a(n-1)-k)):= true$2; k
%p A257941       fi
%p A257941     end:
%p A257941 seq(a(n), n=1..101);
%t A257941 s[_] = False; b[_] = False;
%t A257941 a[n_] := a[n] = Module[{i, k}, If[n == 1, b[1] = True; 1, For[k = 1, b[k] || s[k] || Function[t, b[t] || t == k][Abs[a[n-1]-k]], k++]; For[i = 1, i <= n-1, i++, s[a[i]+k] = True]; {b[k], b[Abs[a[n-1]-k]]} = {True, True}; k]];
%t A257941 Array[a, 101] (* _Jean-François Alcover_, Oct 28 2020, after Maple *)
%Y A257941 Cf. A005228, A030124, A033627, A095115, A140778, A257944.
%K A257941 nonn,look
%O A257941 1,2
%A A257941 _Eric Angelini_ and _Alois P. Heinz_, May 13 2015