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.

A256187 First differences of Per Nørgård's "infinity sequence" A004718.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Mar 19 2015

Keywords

Comments

Per Nørgård's surname is also written as Noergaard;
a(n) = A004718(n+1) - A004718(n);
a(n) != 0, as A004718 is non-repetitive;
for all integers k > 0, there exist infinitely many m such that abs(a(m)) = k, see link.

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