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.

A356385 First differences of A353654 which is numbers with the same number of trailing 0 bits as other 0 bits.

Original entry on oeis.org

2, 4, 3, 5, 7, 4, 5, 5, 10, 8, 4, 5, 13, 8, 10, 6, 10, 8, 4, 5, 9, 20, 16, 8, 10, 14, 8, 10, 6, 10, 8, 4, 5, 25, 16, 20, 12, 20, 16, 8, 10, 10, 20, 16, 8, 10, 14, 8, 10, 6, 10, 8, 4, 5, 17, 40, 32, 16, 20, 28, 16, 20, 12, 20, 16, 8, 10, 26, 16, 20, 12, 20, 16
Offset: 1

Views

Author

Mikhail Kurkov, Aug 05 2022

Keywords

Crossrefs

Programs

  • Mathematica
    Differences @ Join[{1}, Select[Range[2, 1000], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Sep 21 2022 *)
  • PARI
    isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ A353654
    lista(nn) = my(v=select(isok, [1..nn])); vector(#v-1, k, v[k+1] - v[k]); \\ Michel Marcus, Sep 21 2022
    (Python 3.10+)
    from itertools import pairwise, count, islice
    def A356385_gen(): # generator of terms
        return map(lambda x:x[1]-x[0],pairwise(filter(lambda n:(~n & n-1).bit_length()<<1 == n.bit_length()-n.bit_count(),count(1))))
    A356385_list = list(islice(A356385_gen(),30)) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = A353654(n+1) - A353654(n) for n > 0.
a(A000045(n)-1) = 5 for n > 4.