[go: up one dir, main page]

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

%I #15 Jan 02 2023 12:30:51

%S 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 78,44,46,86,50,52,100,54,56,108,58,62,114,66,64,70,72,140,74,76,146,

%U 80,82,156,84,88,170,90,92,180,94,96,188,98,102,194,104,106,208

%N 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 All terms are even.

%H Alois P. Heinz, <a href="/A258137/b258137.txt">Table of n, a(n) for n = 1..1000</a>

%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2015-May/014890.html">Derangements</a> on the SeqFan list, May 21 2015

%F a(n) = abs(A258136(n+1)-A258136(n)).

%F a(n) = 2*abs(A099004(n)).

%p b:= proc() false end:

%p g:= proc(n) option remember; local k;

%p if n=1 then b(1):= true; 1

%p else g(n-1); for k while b(k) or

%p b(abs(g(n-1)-k)) by 2 do od;

%p b(k), b(abs(g(n-1)-k)):= true$2; k

%p fi

%p end:

%p a:= n-> abs(g(n+1)-g(n)):

%p seq(a(n), n=1..101);

%t b[_] = False;

%t g[n_] := g[n] = Module[{k},

%t If[n == 1, b[1] = True; 1,

%t g[n-1]; For[k = 1, b[k] ||

%t b[Abs[g[n-1] - k]], k += 2];

%t {b[k], b[Abs[g[n-1] - k]]} = {True, True}; k]];

%t a[n_] := Abs[g[n+1] - g[n]];

%t Table[a[n], {n, 1, 101}] (* _Jean-François Alcover_, Aug 01 2021, after _Alois P. Heinz_ *)

%Y Absolute first differences of A258136.

%Y Cf. A099004, A257941, A257944.

%K nonn

%O 1,1

%A _Eric Angelini_ and _Alois P. Heinz_, May 21 2015