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.

Showing 1-9 of 9 results.

A048678 Binary expansion of nonnegative integers expanded to "Zeckendorffian format" with rewrite rules 0->0, 1->01.

Original entry on oeis.org

0, 1, 2, 5, 4, 9, 10, 21, 8, 17, 18, 37, 20, 41, 42, 85, 16, 33, 34, 69, 36, 73, 74, 149, 40, 81, 82, 165, 84, 169, 170, 341, 32, 65, 66, 133, 68, 137, 138, 277, 72, 145, 146, 293, 148, 297, 298, 597, 80, 161, 162, 325, 164, 329, 330, 661, 168, 337, 338, 677, 340
Offset: 0

Views

Author

Keywords

Comments

No two adjacent 1-bits. Permutation of A003714.
Replace 1 with 01 in binary. - Ralf Stephan, Oct 07 2003

Examples

			11=1011 in binary, thus is rewritten as 100101 = 37 in decimal.
		

Crossrefs

MASKTRANS transform of A053644.
Cf. A124108.

Programs

  • Haskell
    a048678 0 = 0
    a048678 x = 2 * (b + 1) * a048678 x' + b
                where (x', b) = divMod x 2
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Maple
    rewrite_0to0_1to01 := proc(n) option remember; if(n < 2) then RETURN(n); else RETURN(((2^(1+(n mod 2))) * rewrite_0to0_1to01(floor(n/2))) + (n mod 2)); fi; end;
  • Mathematica
    f[n_] := FromDigits[ Flatten[IntegerDigits[n, 2] /. {1 -> {0, 1}}], 2]; Table[f@n, {n, 0, 60}] (* Robert G. Wilson v, Dec 11 2009 *)
  • PARI
    a(n)=if(n<1,0,(3-(-1)^n)*a(floor(n/2))+(1-(-1)^n)/2)
    
  • PARI
    a(n) = if(n == 0, 0, my(A = -2); sum(i = 0, logint(n, 2), A++; if(bittest(n, i), 1 << (A++)))) \\ Mikhail Kurkov, Mar 14 2024
    
  • Python
    def a(n):
        return 0 if n==0 else (3 - (-1)**n)*a(n//2) + (1 - (-1)**n)//2
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 30 2017
    
  • Python
    def A048678(n): return int(bin(n)[2:].replace('1','01'),2) # Chai Wah Wu, Mar 18 2024

Formula

a(n) = rewrite_0to0_1to01(n) [ Each 0->1, 1->10 in binary expansion of n ].
a(0)=0; a(n) = (3-(-1)^n)*a(floor(n/2))+(1-(-1)^n)/2. - Benoit Cloitre, Aug 31 2003
a(0)=0, a(2n) = 2a(n), a(2n+1) = 4a(n) + 1. - Ralf Stephan, Oct 07 2003

A175047 Write n in binary, then increase each run of 0's by one 0. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

1, 4, 3, 8, 9, 12, 7, 16, 17, 36, 19, 24, 25, 28, 15, 32, 33, 68, 35, 72, 73, 76, 39, 48, 49, 100, 51, 56, 57, 60, 31, 64, 65, 132, 67, 136, 137, 140, 71, 144, 145, 292, 147, 152, 153, 156, 79, 96, 97, 196, 99, 200, 201, 204, 103, 112, 113, 228, 115, 120, 121, 124, 63, 128
Offset: 1

Views

Author

Leroy Quet, Dec 02 2009

Keywords

Comments

From Reinhard Zumkeller, Dec 12 2009: (Start)
A070939(a(n)) = A070939(n) + A033264(n);
A171598 and A171599 give record values and where they occur. (End)

Examples

			12 in binary is 1100. Increase each run of 0 by one digit to get 11000, which is 24 in decimal. So a(12) = 24.
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a175047 = foldr (\b v -> 2 * v + b) 0 . concatMap
       (\bs@(b:_) -> if b == 0 then 0 : bs else bs) . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • Mathematica
    f[n_] := Block[{s = Split@ IntegerDigits[n, 2]}, FromDigits[ Flatten@ Insert[s, {0}, Table[{2 i}, {i, Floor[ Length@s/2]} ]], 2]]; Array[ f, 64] (* Robert G. Wilson v, Dec 11 2009 *)
  • Python
    from re import split
    def A175047(n):
      return int(''.join(d+'0' if '0' in d else d for d in split('(0+)|(1+)',bin(n)[2:]) if d != '' and d != None),2) # Chai Wah Wu, Nov 21 2018

Formula

a(n) = if n<2 then n else 2*(1 + 0^((n+2) mod 4))*a([n/2]) + n mod 2. - Reinhard Zumkeller, Jan 20 2010
a(2^n) = 2^(n+1). - Chai Wah Wu, Nov 21 2018

Extensions

Extended by Ray Chandler, Dec 18 2009
a(11) onwards from Robert G. Wilson v and Reinhard Zumkeller, Dec 11 2009

A088698 Replace 1 with 11 in binary representation of n.

Original entry on oeis.org

0, 3, 6, 15, 12, 27, 30, 63, 24, 51, 54, 111, 60, 123, 126, 255, 48, 99, 102, 207, 108, 219, 222, 447, 120, 243, 246, 495, 252, 507, 510, 1023, 96, 195, 198, 399, 204, 411, 414, 831, 216, 435, 438, 879, 444, 891, 894, 1791, 240, 483, 486, 975, 492, 987, 990
Offset: 0

Views

Author

Ralf Stephan, Oct 07 2003

Keywords

Examples

			n=9: 1001 -> 110011 = 51, so a(9) = 51.
		

Crossrefs

Ordered terms plus one are in A048297.
Same sequence sorted into ascending order: A277335, A290258 (without 0).
Main diagonal of A341520, right edge of A341521.

Programs

  • PARI
    a(n)=if(n<1,0,if(n%2==0,2*a(n/2),4*a((n-1)/2)+3))
    
  • Python
    def a(n): return int(bin(n)[2:].replace('1', '11'), 2)
    print([a(n) for n in range(55)]) # Michael S. Branicky, Feb 20 2021

Formula

a(0)=0, a(2n) = 2a(n), a(2n+1) = 4a(n) + 3.

A353654 Numbers whose binary expansion has the same number of trailing 0 bits as other 0 bits.

Original entry on oeis.org

1, 3, 7, 10, 15, 22, 26, 31, 36, 46, 54, 58, 63, 76, 84, 94, 100, 110, 118, 122, 127, 136, 156, 172, 180, 190, 204, 212, 222, 228, 238, 246, 250, 255, 280, 296, 316, 328, 348, 364, 372, 382, 392, 412, 428, 436, 446, 460, 468, 478, 484, 494, 502, 506, 511, 528, 568
Offset: 1

Views

Author

Mikhail Kurkov, Jul 15 2022

Keywords

Comments

Numbers k such that A007814(k) = A086784(k).
To reproduce the sequence through itself, use the following rule: if binary 1xyz is a term then so are 11xyz and 10xyz0 (except for 1 alone where 100 is not a term).
The number of terms with bit length k is equal to Fibonacci(k-1) for k > 1.
Conjecture: 2*A247648(n-1) + 1 with rewrite 1 -> 1, 01 -> 0 applied to binary expansion is the same as a(n) without trailing 0 bits in binary.
Odd terms are positive Mersenne numbers (A000225), because there is no 0 in their binary expansion. - Bernard Schott, Oct 12 2022

Crossrefs

Cf. A356385 (first differences).
Subsequences with same number k of trailing 0 bits and other 0 bits: A000225 (k=0), 2*A190620 (k=1), 4*A357773 (k=2), 8*A360573 (k=3).

Programs

  • Maple
    N:= 10: # for terms <= 2^N
    S:= {1};
    for d from 1 to N do
      for k from 0 to d/2-1 do
        B:= combinat:-choose([$k+1..d-2],k);
        S:= S union convert(map(proc(t) local s; 2^d - 2^k - add(2^(s),s=t) end proc,B),set);
    od od:
    sort(convert(S,list)); # Robert Israel, Sep 21 2023
  • Mathematica
    Join[{1}, Select[Range[2, 600], IntegerExponent[#, 2] == Floor[Log2[# - 1]] - DigitCount[# - 1, 2, 1] &]] (* Amiram Eldar, Jul 16 2022 *)
  • PARI
    isok(k) = if (k==1, 1, (logint(k-1, 2)-hammingweight(k-1) == valuation(k, 2))); \\ Michel Marcus, Jul 16 2022
    
  • Python
    from itertools import islice, count
    def A353654_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(m:=(~n & n-1).bit_length()) == bin(n>>m)[2:].count('0'),count(max(startvalue,1)))
    A353654_list = list(islice(A353654_gen(),30)) # Chai Wah Wu, Oct 14 2022

Formula

a(n) = a(n-1) + A356385(n-1) for n > 1 with a(1) = 1.
Conjectured formulas: (Start)
a(n) = 2^g(n-1)*(h(n-1) + 2^A000523(h(n-1))*(2 - g(n-1))) for n > 2 with a(1) = 1, a(2) = 3 where f(n) = n - A130312(n), g(n) = [n > 2*f(n)] and where h(n) = a(f(n) + 1).
a(n) = 1 + 2^r(n-1) + Sum_{k=1..r(n-1)} (1 - g(s(n-1, k)))*2^(r(n-1) - k) for n > 1 with a(1) = 1 where r(n) = A072649(n) and where s(n, k) = f(s(n, k-1)) for n > 0, k > 1 with s(n, 1) = n.
a(n) = 2*(2 + Sum_{k=1..n-2} 2^(A213911(A280514(k)-1) + 1)) - 2^A200650(n) for n > 1 with a(1) = 1.
A025480(a(n)-1) = A348366(A343152(n-1)) for n > 1.
a(A000045(n)) = 2^(n-1) - 1 for n > 1. (End)

A340666 A(n,k) is derived from n by replacing each 0 in its binary representation with a string of k 0's; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 1, 2, 3, 0, 1, 4, 3, 1, 0, 1, 8, 3, 4, 3, 0, 1, 16, 3, 16, 5, 3, 0, 1, 32, 3, 64, 9, 6, 7, 0, 1, 64, 3, 256, 17, 12, 7, 1, 0, 1, 128, 3, 1024, 33, 24, 7, 8, 3, 0, 1, 256, 3, 4096, 65, 48, 7, 64, 9, 3, 0, 1, 512, 3, 16384, 129, 96, 7, 512, 33, 10, 7
Offset: 0

Views

Author

Alois P. Heinz, Jan 15 2021

Keywords

Examples

			Square array A(n,k) begins:
  0, 0,  0,   0,    0,     0,      0,       0,        0, ...
  1, 1,  1,   1,    1,     1,      1,       1,        1, ...
  1, 2,  4,   8,   16,    32,     64,     128,      256, ...
  3, 3,  3,   3,    3,     3,      3,       3,        3, ...
  1, 4, 16,  64,  256,  1024,   4096,   16384,    65536, ...
  3, 5,  9,  17,   33,    65,    129,     257,      513, ...
  3, 6, 12,  24,   48,    96,    192,     384,      768, ...
  7, 7,  7,   7,    7,     7,      7,       7,        7, ...
  1, 8, 64, 512, 4096, 32768, 262144, 2097152, 16777216, ...
  ...
		

Crossrefs

Columns k=0-2, 4 give: A038573, A001477, A084471, A084473.
Rows n=0..17, 19 give: A000004, A000012, A000079, A010701, A000302, A000051(k+1), A007283, A010727, A001018, A087289, A007582(k+1), A062709(k+2), A164346, A181565(k+1), A005009, A181404(k+3), A001025, A199493, A253208(k+1).
Main diagonal gives A340667.

Programs

  • Maple
    A:= (n, k)-> Bits[Join](subs(0=[0$k][], Bits[Split](n))):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
    # second Maple program:
    A:= proc(n, k) option remember; `if`(n<2, n,
         `if`(irem(n, 2, 'r')=1, A(r, k)*2+1, A(r, k)*2^k))
        end:
    seq(seq(A(n, d-n), n=0..d), d=0..12);
  • Mathematica
    A[n_, k_] := FromDigits[IntegerDigits[n, 2] /. 0 -> Sequence @@ Table[0, {k}], 2];
    Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 02 2021 *)

Formula

A000120(A(n,k)) = A000120(n) = log_2(A(n,0)+1).
A023416(A(n,k)) = k * A023416(n) for n >= 1.

A084473 Replace 0 with 0000 in binary representation of n.

Original entry on oeis.org

1, 16, 3, 256, 33, 48, 7, 4096, 513, 528, 67, 768, 97, 112, 15, 65536, 8193, 8208, 1027, 8448, 1057, 1072, 135, 12288, 1537, 1552, 195, 1792, 225, 240, 31, 1048576, 131073, 131088, 16387, 131328, 16417, 16432, 2055, 135168, 16897, 16912, 2115, 17152, 2145
Offset: 1

Views

Author

Reinhard Zumkeller, May 27 2003

Keywords

Comments

a(n) = n iff n = 2^k - 1, k>0 (A000225). - Bernard Schott, Dec 18 2021

Crossrefs

Programs

  • Haskell
    a084473 1 = 1
    a084473 x = 2 * (if b == 1 then 1 else 8) * a084473 x' + b
                where (x', b) = divMod x 2
    -- Reinhard Zumkeller, Mar 31 2015
    
  • Maple
    a:= n-> Bits[Join](subs(0=[0$4][], Bits[Split](n))):
    seq(a(n), n=1..49);  # Alois P. Heinz, Jan 15 2021
  • Mathematica
    a[n_] := FromDigits[IntegerDigits[n, 2] /. 0 -> Sequence@@{0,0,0,0}, 2];
    Array[a, 50] (* Jean-François Alcover, Dec 16 2021 *)
  • Python
    def a(n): return int(bin(n)[2:].replace('0', '0000'), 2)
    print([a(n) for n in range(1, 46)]) # Michael S. Branicky, Jan 15 2021

Formula

a(1)=1, a(2*k+1)=2*a(k)+1, a(2*k)=16*a(k).
a(n) = A084471(A084471(n)).
A084474(n) = A007088(a(n));
A023416(a(n)) = A023416(n)*4.
A000120(a(n)) = A000120(n).

A088697 Replace 0 with 10 in binary representation of n.

Original entry on oeis.org

0, 1, 6, 3, 26, 13, 14, 7, 106, 53, 54, 27, 58, 29, 30, 15, 426, 213, 214, 107, 218, 109, 110, 55, 234, 117, 118, 59, 122, 61, 62, 31, 1706, 853, 854, 427, 858, 429, 430, 215, 874, 437, 438, 219, 442, 221, 222, 111, 938, 469, 470, 235, 474, 237
Offset: 0

Views

Author

Ralf Stephan, Oct 07 2003

Keywords

Examples

			n=9: 1001 -> 110101 = 53, so a(9) = 53.
		

Crossrefs

Programs

  • Mathematica
    Join[{0},Table[FromDigits[Flatten[IntegerDigits[n,2]/.(0->{1,0})],2],{n,80}]] (* Harvey P. Dale, Dec 05 2023 *)
  • PARI
    a(n)=if(n<1,0,if(n%2==0,4*a(n/2)+2,2*a((n-1)/2)+1))

Formula

a(0)=0, a(2n) = 4a(n) + 2, a(2n+1) = 2a(n) + 1.

A229180 Expansion of (chi(-x) * chi(-x^3))^-3 in powers of x where chi() is a Ramanujan theta function.

Original entry on oeis.org

1, 3, 6, 16, 33, 60, 118, 210, 354, 612, 1008, 1608, 2583, 4035, 6174, 9448, 14196, 21024, 31054, 45282, 65322, 93884, 133638, 188640, 265225, 370086, 512934, 708136, 971628, 1325724, 1802134, 2437200, 3280452, 4400132, 5876184, 7815288, 10360890, 13683525
Offset: 0

Views

Author

Michael Somos, Sep 30 2013

Keywords

Comments

Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
In Verrill (1999) section 2.6, denoted by g as a function of q.

Examples

			G.f. = 1 + 3*x + 6*x^2 + 16*x^3 + 33*x^4 + 60*x^5 + 118*x^6 + 210*x^7 + ...
G.f. = q + 3*q^3 + 6*q^5 + 16*q^7 + 33*q^9 + 60*q^11 + 118*q^13 + 210*q^15 + ...
		

References

  • H. Verrill, Some Congruences related to modular forms, Max Planck Institute, 1999.

Crossrefs

Programs

  • Mathematica
    a[ n_] := SeriesCoefficient[ 1 / (QPochhammer[ x, x^2] QPochhammer[x^3, x^6])^3, {x, 0, n}];
    nmax = 40; CoefficientList[Series[Product[1/((1 - x^(2*k - 1)) * (1 - x^(6*k - 3)))^3, {k, 1, nmax}], {x, 0, nmax}], x] (* Vaclav Kotesovec, Sep 07 2015 *)
  • PARI
    {a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( (eta(x^2 + A) * eta(x^6 + A) / (eta(x + A) * eta(x^3 + A)))^3, n))};

Formula

Expansion of q^(-1/2) * (eta(q^2) * eta(q^6) / (eta(q) * eta(q^3)))^3 in powers of q.
Euler transform of period 6 sequence [3, 0, 6, 0, 3, 0, ...].
G.f. is a period 1 Fourier series which satisfies f(-1 / (24 t)) = (1/8) g(t) where q = exp(2 Pi i t) and g() is the g.f. for A058492.
G.f.: t / (1 - 10*t^2 + 9*t^4)^(1/2) where t = the g.f. of A217786.
G.f.: 1 / (Product_{k>0} (1 - x^(2*k - 1)) * (1 - x^(6*k - 3)))^3.
Convolution inverse of A058492.
a(n) ~ exp(2*Pi*sqrt(n/3)) / (16 * 3^(1/4) * n^(3/4)). - Vaclav Kotesovec, Sep 07 2015

A084472 Write n in binary and replace 0 with 00.

Original entry on oeis.org

1, 100, 11, 10000, 1001, 1100, 111, 1000000, 100001, 100100, 10011, 110000, 11001, 11100, 1111, 100000000, 10000001, 10000100, 1000011, 10010000, 1001001, 1001100, 100111, 11000000, 1100001, 1100100, 110011, 1110000
Offset: 1

Views

Author

Reinhard Zumkeller, May 27 2003

Keywords

Comments

a(n)=A007088(A084471(n)).

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Flatten[IntegerDigits[n,2]/.(0->{0,0})]],{n,30}] (* Harvey P. Dale, Aug 27 2019 *)
Showing 1-9 of 9 results.