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.

A020330 Numbers whose base-2 representation is the juxtaposition of two identical strings.

Original entry on oeis.org

3, 10, 15, 36, 45, 54, 63, 136, 153, 170, 187, 204, 221, 238, 255, 528, 561, 594, 627, 660, 693, 726, 759, 792, 825, 858, 891, 924, 957, 990, 1023, 2080, 2145, 2210, 2275, 2340, 2405, 2470, 2535, 2600, 2665, 2730, 2795, 2860, 2925, 2990, 3055, 3120, 3185, 3250
Offset: 1

Views

Author

David W. Wilson, Melia Aldridge (ma38(AT)spruce.evansville.edu)

Keywords

Comments

All differences are in union of A000051 and A001576. - Vladimir Shevelev, Dec 07 2013

Examples

			36 is a term because 36 = 100100_2, which is 100 followed by 100.
		

Crossrefs

Subsequence of A121016.
Column k=0 of A246830, column k=1 of A246834.

Programs

  • Haskell
    a020330 n = foldr (\d v -> 2 * v + d) 0 (bs ++ bs) where
       bs = a030308_row n
    -- Reinhard Zumkeller, Feb 19 2013
    
  • Magma
    [n+2*n*2^Floor(Log(2, n)): n in [1..50]]; // Vincenzo Librandi, Apr 05 2018
    
  • Maple
    a:= n-> (l-> Bits[Join]([l[],l[]]))(Bits[Split](n)):
    seq(a(n), n=1..50);  # Alois P. Heinz, Aug 24 2024
  • Mathematica
    Table[n + 2 n 2^Floor[Log[2, n]], {n, 50}] (* T. D. Noe, Dec 10 2013 *)
    FromDigits[#, 2] & /@ (# <> # & /@ IntegerString[Range@100, 2]) (* Hans Rudolf Widmer, Aug 24 2024 *)
  • PARI
    a(n)=n+n<<#binary(n) \\ Charles R Greathouse IV, Mar 29 2013
    
  • PARI
    is(n)=my(L=#binary(n)\2); n>>L==bitand(n,2^L-1) \\ Charles R Greathouse IV, Mar 29 2013
    
  • Python
    def a(n): return int(bin(n)[2:]*2, 2)
    print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Mar 10 2021
    
  • Python
    def A020330(n): return (n<Chai Wah Wu, Feb 28 2023

Formula

a(n) = n + 2*n*2^floor(log_2(n)). - Ralf Stephan, Dec 07 2004
Sum_{n>=1} 1/a(n) = A330157. - Amiram Eldar, Oct 22 2020
a(n) = n * (2^A070939(n) + 1). - Jianing Song, Apr 10 2021