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.

A285779 Parity index: number of integers z with 1 <= z <= n for which A010060(z) = A010060(n), negated if A010060(n) = 1.

Original entry on oeis.org

0, -1, -2, 1, -3, 2, 3, -4, -5, 4, 5, -6, 6, -7, -8, 7, -9, 8, 9, -10, 10, -11, -12, 11, 12, -13, -14, 13, -15, 14, 15, -16, -17, 16, 17, -18, 18, -19, -20, 19, 20, -21, -22, 21, -23, 22, 23, -24, 24, -25, -26, 25, -27, 26, 27, -28, -29, 28, 29, -30, 30, -31, -32, 31, -33, 32, 33, -34, 34, -35, -36, 35, 36
Offset: 0

Views

Author

Reikku Kulon, Apr 25 2017

Keywords

Comments

Signs are given by A010059 or A010060, the Thue-Morse sequence. Here, zero has positive sign. Like A130472, this sequence maps the natural numbers to the integers. Positive terms are one less than the corresponding term in A008619.
This was a test problem for seqr, a genetic programming integer sequence recognizer, which discovered a method for generating terms of the sequence given the bits of n in descending order.
Iterating over the bits of n in ascending order yields a sequence with more irregular behavior, differing in absolute value by up to 2: 0, -1, -2, 0, -3, +3, +3, +2, -5, 5, 5, ...
Consecutive terms of A285779 usually differ in absolute value by 1 or 2, but consecutive terms differing only in sign occur irregularly. This happens first for a(11) = -6 and a(12) = +6.

Crossrefs

Programs

  • Mathematica
    Function[s, Table[(2 Boole[# == 0] - 1) Count[Take[s, n], z_ /; z == #] &@ s[[n]], {n, 0, Length@ s}]]@ Array[ThueMorse, 72] (* Michael De Vlieger, May 10 2017, Version 10.2 *)
  • PARI
    a(n) = {my(v = 1); forstep(b = length(binary(n)) - 1, 0, -1, if(bittest(n, b), v = bitxor(-v, 2^b)); ); v = bitnegimply(v, 1); return(v / 2)}