login
Sequence of which A078783 is the Recamán transform.
5

%I #15 Aug 02 2018 08:49:50

%S 0,1,2,3,4,5,6,9,10,11,20,21,22,40,41,42,82,83,84,166,167,168,334,335,

%T 336,670,671,672,1340,1341,1342,2682,2683,2684,5366,5367,5368,10734,

%U 10735,10736,21470,21471,21472,42942,42943,42944,85886,85887,85888

%N Sequence of which A078783 is the Recamán transform.

%C The d() sequence mentioned in A078783. Absolute values of first differences of A078783.

%D N. J. A. Sloane and Allan Wilks, On sequences of Recaman type, paper in preparation, 2006.

%H Reinhard Zumkeller, <a href="/A117073/b117073.txt">Table of n, a(n) for n = 0..10000</a>

%t b[0] = 0; b[1] = 1;

%t b[n_] := b[n] = For[m = 2, True, m++, If[FreeQ[Array[b, n-1], m], If[Abs[m - b[n-1]] > Abs[b[n-1] - b[n-2]], Return[m]]]];

%t a[0] = 0; a[n_] := a[n] = Abs[b[n] - b[n-1]];

%t Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 0, 50}] (* _Jean-François Alcover_, Aug 02 2018 *)

%o (Haskell)

%o a117073 n = a117073_list !! n

%o -- a117073_list defined in A078783. -- _Reinhard Zumkeller_, May 01 2015

%Y Cf. A078783.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, Apr 17 2006