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.

A258137 Absolute first differences of the lexicographically earliest sequence of odd positive integers such that the terms and their absolute first differences are all distinct.

This page as a plain text file.
%I A258137 #16 Dec 23 2024 14:53:44
%S A258137 2,4,6,8,10,12,18,14,16,28,20,22,36,24,26,48,30,32,60,34,38,68,40,42,
%T A258137 78,44,46,86,50,52,100,54,56,108,58,62,114,66,64,70,72,140,74,76,146,
%U A258137 80,82,156,84,88,170,90,92,180,94,96,188,98,102,194,104,106,208
%N A258137 Absolute first differences of the lexicographically earliest sequence of odd positive integers such that the terms and their absolute first differences are all distinct.
%C A258137 All terms are even.
%H A258137 Alois P. Heinz, <a href="/A258137/b258137.txt">Table of n, a(n) for n = 1..1000</a>
%H A258137 E. Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2015-May/014890.html">Derangements</a> on the SeqFan list, May 21 2015
%F A258137 a(n) = abs(A258136(n+1)-A258136(n)).
%F A258137 a(n) = 2*abs(A099004(n)).
%p A258137 b:= proc() false end:
%p A258137 g:= proc(n) option remember; local k;
%p A258137       if n=1 then b(1):= true; 1
%p A258137     else g(n-1); for k while b(k) or
%p A258137          b(abs(g(n-1)-k)) by 2 do od;
%p A258137          b(k), b(abs(g(n-1)-k)):= true$2; k
%p A258137       fi
%p A258137     end:
%p A258137 a:= n-> abs(g(n+1)-g(n)):
%p A258137 seq(a(n), n=1..101);
%t A258137 b[_] = False;
%t A258137 g[n_] := g[n] = Module[{k},
%t A258137      If[n == 1, b[1] = True; 1,
%t A258137      g[n-1]; For[k = 1, b[k] ||
%t A258137      b[Abs[g[n-1] - k]], k += 2];
%t A258137      {b[k], b[Abs[g[n-1] - k]]} = {True, True}; k]];
%t A258137 a[n_] := Abs[g[n+1] - g[n]];
%t A258137 Table[a[n], {n, 1, 101}] (* _Jean-François Alcover_, Aug 01 2021, after _Alois P. Heinz_ *)
%Y A258137 Absolute first differences of A258136.
%Y A258137 Cf. A099004, A257941, A257944.
%K A258137 nonn
%O A258137 1,1
%A A258137 _Eric Angelini_ and _Alois P. Heinz_, May 21 2015