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.

A297405 Binary "cubes"; numbers whose binary representation consists of three consecutive identical blocks.

Original entry on oeis.org

7, 42, 63, 292, 365, 438, 511, 2184, 2457, 2730, 3003, 3276, 3549, 3822, 4095, 16912, 17969, 19026, 20083, 21140, 22197, 23254, 24311, 25368, 26425, 27482, 28539, 29596, 30653, 31710, 32767, 133152, 137313, 141474, 145635, 149796, 153957, 158118, 162279, 166440, 170601, 174762, 178923, 183084, 187245
Offset: 1

Views

Author

Jeffrey Shallit, Dec 29 2017

Keywords

Comments

Alternatively, numbers of the form k*(4^n + 2^n + 1), where 2^(n-1) <= k < 2^n.

Examples

			42 in base 2 is 101010, which consists of three copies of the block "10".
		

Crossrefs

Cf. A020330, which is the corresponding sequence for squares.
Subsequence of A121016.

Programs

  • Maple
    a:= n-> (p-> n*(1+2^p+4^p))(1+ilog2(n)):
    seq(a(n), n=1..50);  # Alois P. Heinz, Dec 29 2017
  • Mathematica
    bc[n_]:=FromDigits[Join[n,n,n],2]; Flatten[Table[bc/@Select[Tuples[ {1,0},n],#[[1]] == 1&],{n,6}]]//Union (* Harvey P. Dale, Oct 09 2021 *)
  • PARI
    a(n) = n=binary(n); fromdigits(concat([n, n, n]) , 2) \\ Iain Fox, Jul 04 2022
  • Python
    def a(n): return int(bin(n)[2:]*3, 2)
    print([a(n) for n in range(1, 46)]) # Michael S. Branicky, Jul 04 2022
    # Alternative:
    def A297405(n):
        p = n.bit_length()
        return n * (1 + 2**p + 4**p)
    print([A297405(n) for n in range(1, 46)])  # Peter Luschny, Jul 05 2022
    

Formula

a(n) = n*(1 + 2^p + 4^p) with p = 1 + floor(log_2(n)). - Alois P. Heinz, Dec 29 2017
G.f.: (7*x + Sum_{n>=1} (4^n + 3*8^n + (2^n + 2*4^n - 3*8^n)*x)*x^(2^n))/(1-x)^2. - Robert Israel, Dec 31 2017