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.

Previous Showing 11-20 of 39 results. Next

A048967 Number of even entries in row n of Pascal's triangle (A007318).

Original entry on oeis.org

0, 0, 1, 0, 3, 2, 3, 0, 7, 6, 7, 4, 9, 6, 7, 0, 15, 14, 15, 12, 17, 14, 15, 8, 21, 18, 19, 12, 21, 14, 15, 0, 31, 30, 31, 28, 33, 30, 31, 24, 37, 34, 35, 28, 37, 30, 31, 16, 45, 42, 43, 36, 45, 38, 39, 24, 49, 42, 43, 28, 45, 30, 31, 0, 63, 62, 63, 60, 65, 62, 63, 56, 69, 66, 67
Offset: 0

Views

Author

Keywords

Comments

In rows 2^k - 1 all entries are odd.
a(n) = 0 (all the entries in the row are odd) iff n = 2^m - 1 for some m >= 0 and then n belongs to sequence A000225. - Avi Peretz (njk(AT)netvision.net.il), Apr 21 2001
Also number of zeros in n-th row of SierpiƄski's triangle (cf. A047999): a(n) = A023416(A001317(n)). - Reinhard Zumkeller, Nov 24 2012

Examples

			Row 4 is 1 4 6 4 1 with 3 even entries so a(4)=3.
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a048967 n = a048967_list !! n
    a048967_list = 0 : xs where
       xs = 0 : concat (transpose [zipWith (+) [1..] xs, map (* 2) xs])
    -- Reinhard Zumkeller, Nov 14 2014, Nov 24 2012
    
  • Mathematica
    Table[n + 1 - Sum[ Mod[ Binomial[n, k], 2], {k, 0, n} ], {n, 0, 100} ]
    a[n_] := n + 1 - 2^DigitCount[n, 2, 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 27 2023 *)
  • PARI
    a(n)=if(n<1,0,if(n%2==0,a(n/2)+n/2,2*a((n-1)/2)))
    
  • Python
    def A048967(n): return n+1-(1<Chai Wah Wu, May 03 2023

Formula

a(n) = n+1 - A001316(n) = n+1 - 2^A000120(n) = n+1 - Sum_{k=0..n} (C(n, k) mod 2) = Sum_{k=0..n} ((1 - C(n, k)) mod 2).
a(2n) = a(n) + n, a(2n+1) = 2a(n). - Ralf Stephan, Oct 07 2003
a(n) = row sums in A219463 = A000120(A219843(n)). - Reinhard Zumkeller, Nov 30 2012
A249304(n+1) = a(n+1) + a(n). - Reinhard Zumkeller, Nov 14 2014
G.f.: 1/(1 - x)^2 - Product_{k>=0} (1 + 2*x^(2^k)). - Ilya Gutkovskiy, Jul 19 2019

A038574 Write n in ternary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 1, 4, 5, 2, 5, 8, 1, 4, 5, 4, 13, 14, 5, 14, 17, 2, 5, 8, 5, 14, 17, 8, 17, 26, 1, 4, 5, 4, 13, 14, 5, 14, 17, 4, 13, 14, 13, 40, 41, 14, 41, 44, 5, 14, 17, 14, 41, 44, 17, 44, 53, 2, 5, 8, 5, 14, 17, 8, 17, 26, 5, 14, 17, 14, 41, 44, 17, 44, 53, 8, 17, 26, 17, 44, 53, 26, 53, 80
Offset: 0

Views

Author

Keywords

Examples

			15 = 120 -> 012 = 5, so a(15)=5.
		

Crossrefs

Programs

  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n,3]],3],{n,0,90}] (* Harvey P. Dale, Dec 08 2015 *)

Extensions

More terms from Erich Friedman.

A084471 Change 0 to 00 in binary representation of n.

Original entry on oeis.org

1, 4, 3, 16, 9, 12, 7, 64, 33, 36, 19, 48, 25, 28, 15, 256, 129, 132, 67, 144, 73, 76, 39, 192, 97, 100, 51, 112, 57, 60, 31, 1024, 513, 516, 259, 528, 265, 268, 135, 576, 289, 292, 147, 304, 153, 156, 79, 768, 385, 388, 195, 400, 201, 204, 103, 448, 225
Offset: 1

Views

Author

Reinhard Zumkeller, May 27 2003

Keywords

Comments

a(n) = n iff n = 2^k - 1, k>0.
A023416(a(n))=A023416(n)*2; A000120(a(n))=A000120(n);

Crossrefs

Cf. A084472(n)=A007088(a(n)), A084473, A038573.
Ordered terms are in A060142.
Column k=2 of A340666.
Cf. A088698, A175047. - Robert G. Wilson v, Dec 10 2009

Programs

  • Haskell
    a084471 1 = 1
    a084471 x = 2 * (2 - d) * a084471 x' + d  where (x',d) = divMod x 2
    -- Reinhard Zumkeller, Jul 16 2012
  • Maple
    a:= n-> Bits[Join](subs(0=[0$2][], Bits[Split](n))):
    seq(a(n), n=1..60);  # Alois P. Heinz, Jan 15 2021
  • Mathematica
    f[n_] := FromDigits[Flatten[IntegerDigits[n, 2] /. {0 -> {0, 0}}], 2]; Array[f, 60] (* Robert G. Wilson v, Dec 10 2009 *)

Formula

a(1)=1, a(2*k+1)=2*a(k)+1, a(2*k)=4*a(k).

A319652 Write n in 4-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 1, 5, 6, 7, 2, 6, 10, 11, 3, 7, 11, 15, 1, 5, 6, 7, 5, 21, 22, 23, 6, 22, 26, 27, 7, 23, 27, 31, 2, 6, 10, 11, 6, 22, 26, 27, 10, 26, 42, 43, 11, 27, 43, 47, 3, 7, 11, 15, 7, 23, 27, 31, 11, 27, 43, 47, 15, 31, 47, 63, 1, 5, 6, 7, 5, 21, 22, 23, 6, 22, 26, 27
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), this sequence (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).
Cf. A165012.

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*4^(i-1), i=1..nops(l)))(sort(convert(n, base, 4))):
    seq(a(n), n=0..75);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 4]], 4], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 4)), 4); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(4, 100)
    

A319653 Write n in 5-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 1, 6, 7, 8, 9, 2, 7, 12, 13, 14, 3, 8, 13, 18, 19, 4, 9, 14, 19, 24, 1, 6, 7, 8, 9, 6, 31, 32, 33, 34, 7, 32, 37, 38, 39, 8, 33, 38, 43, 44, 9, 34, 39, 44, 49, 2, 7, 12, 13, 14, 7, 32, 37, 38, 39, 12, 37, 62, 63, 64, 13, 38, 63, 68, 69, 14, 39, 64, 69, 74, 3
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), this sequence (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n,5]],5],{n,0,100}] (* Harvey P. Dale, Feb 29 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 5)), 5); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(5, 100)
    

A319654 Write n in 6-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 1, 7, 8, 9, 10, 11, 2, 8, 14, 15, 16, 17, 3, 9, 15, 21, 22, 23, 4, 10, 16, 22, 28, 29, 5, 11, 17, 23, 29, 35, 1, 7, 8, 9, 10, 11, 7, 43, 44, 45, 46, 47, 8, 44, 50, 51, 52, 53, 9, 45, 51, 57, 58, 59, 10, 46, 52, 58, 64, 65, 11, 47, 53, 59, 65, 71, 2, 8
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), this sequence (b=6), A319655 (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).

Programs

  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n,6]],6],{n,0,80}] (* Harvey P. Dale, Sep 20 2020 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 6)), 6); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(6, 100)
    

A319655 Write n in 7-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 1, 8, 9, 10, 11, 12, 13, 2, 9, 16, 17, 18, 19, 20, 3, 10, 17, 24, 25, 26, 27, 4, 11, 18, 25, 32, 33, 34, 5, 12, 19, 26, 33, 40, 41, 6, 13, 20, 27, 34, 41, 48, 1, 8, 9, 10, 11, 12, 13, 8, 57, 58, 59, 60, 61, 62, 9, 58, 65, 66, 67, 68, 69, 10, 59, 66, 73
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), this sequence (b=7), A319656 (b=8), A319657 (b=9), A004185 (b=10).

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*7^(i-1), i=1..nops(l)))(sort(convert(n, base, 7))):
    seq(a(n), n=0..73);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 7]], 7], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 7)), 7); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(7, 100)
    

A319656 Write n in 8-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 14, 15, 2, 10, 18, 19, 20, 21, 22, 23, 3, 11, 19, 27, 28, 29, 30, 31, 4, 12, 20, 28, 36, 37, 38, 39, 5, 13, 21, 29, 37, 45, 46, 47, 6, 14, 22, 30, 38, 46, 54, 55, 7, 15, 23, 31, 39, 47, 55, 63, 1, 9, 10, 11, 12, 13, 14
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), this sequence (b=8), A319657 (b=9), A004185 (b=10).
Cf. A165090.

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*8^(i-1), i=1..nops(l)))(sort(convert(n, base, 8))):
    seq(a(n), n=0..70);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 8]], 8], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 8)), 8); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(8, 100)
    

A319657 Write n in 9-ary, sort digits into increasing order.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 10, 11, 12, 13, 14, 15, 16, 17, 2, 11, 20, 21, 22, 23, 24, 25, 26, 3, 12, 21, 30, 31, 32, 33, 34, 35, 4, 13, 22, 31, 40, 41, 42, 43, 44, 5, 14, 23, 32, 41, 50, 51, 52, 53, 6, 15, 24, 33, 42, 51, 60, 61, 62, 7, 16, 25, 34, 43, 52, 61, 70, 71
Offset: 0

Views

Author

Seiichi Manyama, Sep 25 2018

Keywords

Crossrefs

b-ary: A038573 (b=2), A038574 (b=3), A319652 (b=4), A319653 (b=5), A319654 (b=6), A319655 (b=7), A319656 (b=8), this sequence (b=9), A004185 (b=10).
Cf. A165110.

Programs

  • Maple
    a:= n-> (l-> add(l[-i]*9^(i-1), i=1..nops(l)))(sort(convert(n, base, 9))):
    seq(a(n), n=0..71);  # Alois P. Heinz, Aug 07 2024
  • Mathematica
    Table[FromDigits[Sort[IntegerDigits[n, 9]], 9], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n, 9)), 9); \\ Michel Marcus, Sep 25 2018
  • Ruby
    def A(k, n)
      (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)}
    end
    p A(9, 100)
    

A106151 In binary representation of n: delete one zero in each contiguous block of zeros.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, May 07 2005

Keywords

Comments

Equivalently, change bits 10 -> 0. - Michael S. Branicky, Nov 12 2021

Examples

			n=144 = '10010000' -> '101000' = 40 = a(144);
n=145 = '10010001' -> '101001' = 41 = a(145);
n=146 = '10010010' -> '10101'  = 21 = a(146).
		

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a106151 = foldr (\b v -> 2 * v + b) 0 . concatMap
       (\bs'@(b:bs) -> if b == 0 then bs else bs') . group . a030308_row
    -- Reinhard Zumkeller, Jul 05 2013
    
  • PARI
    A106151(n) = if(n<=1, n, if(n%2, 1+(2*A106151((n-1)/2)), A106151(n>>valuation(n, 2))<<(valuation(n, 2)-1))); \\ Antti Karttunen, May 13 2018
    
  • PARI
    A106151(n) = { my(s=0, i=0); while(n, if(2!=(n%4), s += (n%2)<>= 1); (s); }; \\ Antti Karttunen, Jul 01 2024
    
  • Python
    def a(n): return int(bin(n).replace("b", "").replace("10", "1"), 2)
    print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Nov 12 2021

Formula

a(n) <= n; a(n) = n iff n = 2^k-1: a(A000225(n))=A000225(n);
A000120(a(n)) = A000120(n);
A023416(a(n)) = A023416(n) - A087116(n).
a(n) = b(n, 0), where b(n, r) = if n = 1 then 1 else b(floor(n/2), 1 - n mod 2)*(1 + floor((1 + r + n mod 2)/2)) + n mod 2.
For n <= 1, a(n) = n, and for n > 1, if n is odd, then a(n) = 1+2*a((n-1)/2), otherwise, when n is even, a(n) = (2^(A007814(n)-1)) * a(A000265(n)). - Antti Karttunen, May 13 2018
Previous Showing 11-20 of 39 results. Next