A256187 First differences of Per Nørgård's "infinity sequence" A004718.
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, -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, 3, -2, 1, -4, 7, -2, -3, 5, -7, -2, 11, -5, -1, -2, 5, -3, 1, -2, 3, -4
Offset: 0
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Christopher Drexler-Lemire, Jeffrey Shallit, Notes and Note-Pairs in Noergaard's Infinity Series, arXiv:1402.3091 [math.CO], 2014.
Crossrefs
Cf. A004718.
Programs
-
Haskell
a256187 n = a256187_list !! n a256187_list = zipWith (-) (tail a004718_list) a004718_list
-
Mathematica
(* b = A004718 *) b[0] = 0; b[n_?EvenQ] := b[n] = -b[n/2]; b[n_] := b[n] = b[(n-1)/2] + 1; Table[b[n], {n, 0, 72}] // Differences (* Jean-François Alcover, Dec 15 2018 *)
-
Python
from itertools import groupby def A256187(n): c, d = 0, 0 for k, g in groupby(bin(n+1)[2:]): c = c+len(list(g)) if k == '1' else (-c if len(list(g))&1 else c) for k, g in groupby(bin(n)[2:]): d = d+len(list(g)) if k == '1' else (-d if len(list(g))&1 else d) return c-d # Chai Wah Wu, Mar 02 2023
Comments