%I #17 Mar 02 2023 20:09:36
%S 1,-2,3,-1,-1,-2,5,-4,3,-2,1,1,-3,-2,7,-3,-1,-2,5,-3,1,-2,3,-4,5,-2,
%T -1,3,-5,-2,9,-6,3,-2,1,1,-3,-2,7,-4,1,-2,3,-1,-1,-2,5,-1,-3,-2,7,-5,
%U 3,-2,1,-4,7,-2,-3,5,-7,-2,11,-5,-1,-2,5,-3,1,-2,3,-4
%N First differences of Per Nørgård's "infinity sequence" A004718.
%C Per Nørgård's surname is also written as Noergaard;
%C a(n) = A004718(n+1) - A004718(n);
%C a(n) != 0, as A004718 is non-repetitive;
%C for all integers k > 0, there exist infinitely many m such that abs(a(m)) = k, see link.
%H Reinhard Zumkeller, <a href="/A256187/b256187.txt">Table of n, a(n) for n = 0..10000</a>
%H Christopher Drexler-Lemire, Jeffrey Shallit, <a href="http://arxiv.org/abs/1402.3091">Notes and Note-Pairs in Noergaard's Infinity Series</a>, arXiv:1402.3091 [math.CO], 2014.
%t (* b = A004718 *) b[0] = 0; b[n_?EvenQ] := b[n] = -b[n/2]; b[n_] := b[n] = b[(n-1)/2] + 1;
%t Table[b[n], {n, 0, 72}] // Differences (* _Jean-François Alcover_, Dec 15 2018 *)
%o (Haskell)
%o a256187 n = a256187_list !! n
%o a256187_list = zipWith (-) (tail a004718_list) a004718_list
%o (Python)
%o from itertools import groupby
%o def A256187(n):
%o c, d = 0, 0
%o for k, g in groupby(bin(n+1)[2:]):
%o c = c+len(list(g)) if k == '1' else (-c if len(list(g))&1 else c)
%o for k, g in groupby(bin(n)[2:]):
%o d = d+len(list(g)) if k == '1' else (-d if len(list(g))&1 else d)
%o return c-d # _Chai Wah Wu_, Mar 02 2023
%Y Cf. A004718.
%K sign
%O 0,2
%A _Reinhard Zumkeller_, Mar 19 2015
|