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-10 of 12 results. Next

A004152 Sum of digits of n!.

Original entry on oeis.org

1, 1, 2, 6, 6, 3, 9, 9, 9, 27, 27, 36, 27, 27, 45, 45, 63, 63, 54, 45, 54, 63, 72, 99, 81, 72, 81, 108, 90, 126, 117, 135, 108, 144, 144, 144, 171, 153, 108, 189, 189, 144, 189, 180, 216, 207, 216, 225, 234, 225, 216, 198, 279, 279, 261, 279, 333, 270, 288
Offset: 0

Views

Author

Keywords

Comments

If n > 5, then 9 divides a(n). - Enrique Pérez Herrero, Mar 01 2009

Examples

			a(5) = 3 because 5! = 120 and 1 + 2 + 0 = 3.
a(6) = 9 because 6! = 720 and 7 + 2 + 0 = 9.
		

Crossrefs

Cf. A000142 (factorial), A007953 (sum of digits), A079584 (same in base 2), A086358 (digital root of n!).
Cf. A066419 (k such that a(k) does not divide k!).

Programs

Formula

Luca shows that a(n) >> log n. In particular, a(n) > log_10 n - log_10 log_10 n. - Charles R Greathouse IV, Dec 27 2011
a(n) < floor(log_10(n)*9/2). - Carmine Suriano, Feb 20 2013
a(n) = A007953(A000142(n)). - Michel Marcus, Sep 18 2014
a(n) < 9*(A034886(n) - A027868(n)). - Enrique Pérez Herrero, Nov 16 2014
Sanna improved Luca's result to a(n) >> log n log log log n. - Charles R Greathouse IV, Jan 30 2015
a(n) = 9*A202708(n), n>=6. - R. J. Mathar, Jul 30 2021

A095375 Total number of 1's in the binary expansions of the first n primes: summatory A014499.

Original entry on oeis.org

1, 3, 5, 8, 11, 14, 16, 19, 23, 27, 32, 35, 38, 42, 47, 51, 56, 61, 64, 68, 71, 76, 80, 84, 87, 91, 96, 101, 106, 110, 117, 120, 123, 127, 131, 136, 141, 145, 150, 155, 160, 165, 172, 175, 179, 184, 189, 196, 201, 206, 211, 218, 223, 230, 232, 236, 240, 245, 249, 253
Offset: 1

Views

Author

Labos Elemer, Jun 07 2004

Keywords

Examples

			n=4: first 4 primes={10,11,101,111}, with a(4)=8 digits 1.
		

Crossrefs

Programs

  • Maple
    read("transforms") :
    A095375 := proc(n)
        local a;
        a := 0 ;
        for i from 1 to n do
            a := a+wt(ithprime(i)) ;
        end do:
    end proc: # R. J. Mathar, Jul 13 2012
    # second Maple program:
    a:= proc(n) option remember; `if`(n=0, 0, a(n-1)
          +add(i, i=Bits[Split](ithprime(n))))
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 26 2021
  • Mathematica
    lib[x_] :=Count[IntegerDigits[x, 2], 1] {s=0, ta=Table[0, {256}]}; Do[s=s+lib[Prime[n]]; ta[[n]]=s, {n, 1, 256}] ta
  • PARI
    a(n)=my(s);forprime(p=2,prime(n),s+=hammingweight(p));s \\ Charles R Greathouse IV, Mar 29 2013
    
  • Python
    from sympy import primerange, prime
    def A095375(n): return sum(p.bit_count() for p in primerange(prime(n)+1)) # Chai Wah Wu, Nov 12 2024

A078565 Number of zeros in the binary expansion of n!.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 6, 7, 10, 13, 11, 19, 17, 21, 25, 23, 27, 27, 30, 40, 40, 41, 42, 44, 51, 54, 54, 56, 56, 63, 60, 71, 76, 77, 77, 77, 88, 86, 90, 90, 97, 99, 106, 105, 107, 117, 115, 117, 114, 122, 126, 130, 138, 138, 151, 144, 146, 157, 160, 158, 160, 176
Offset: 0

Views

Author

Jose R. Brox (tautocrona(AT)terra.es), Jan 26 2003

Keywords

Examples

			a(4) = 3 because 4! = 24_10 = 11000_2 and it has 3 zero digits.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[IntegerDigits[n!, 2], 0], {n, 0, 100}] (* T. D. Noe, Apr 10 2012 *)
    DigitCount[Range[0,70]!,2,0] (* Harvey P. Dale, Mar 11 2019 *)
  • PARI
    for(n=1,300,b=binary(n!); print1(sum(k=1,length(b),if(b[k],0,1))","))
    
  • Python
    import math
    def a(n):
        return bin(math.factorial(n))[2:].count("0")
    # Indranil Ghosh, Dec 23 2016

Formula

a(n) = A072831(n) - A079584(n). - Michel Marcus, Dec 23 2016

A379151 The binary weights of the Catalan numbers (A000108).

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 2, 6, 6, 9, 6, 8, 8, 12, 9, 16, 13, 17, 12, 17, 13, 18, 15, 25, 20, 17, 20, 24, 28, 25, 26, 25, 25, 32, 27, 34, 29, 32, 33, 29, 35, 29, 31, 36, 35, 44, 44, 49, 40, 46, 48, 44, 38, 50, 43, 44, 46, 47, 55, 50, 52, 58, 59, 60, 65, 68, 56, 62, 68
Offset: 0

Views

Author

Amiram Eldar, Dec 16 2024

Keywords

Examples

			a(10) = 6 because Catalan(10) = 16796 = 100000110011100_2, which has 6 one bits. - _Vincenzo Librandi_, Feb 05 2025
		

Crossrefs

Similar sequences: A011373, A079584, A082481, A379152, A379153.

Programs

  • Magma
    [&+Intseq(Catalan(n), 2): n in [0..100]]; // Vincenzo Librandi, Feb 05 2025
  • Mathematica
    a[n_] := DigitCount[CatalanNumber[n], 2, 1]; Array[a, 100, 0]
  • PARI
    a(n) = hammingweight(binomial(2*n, n)/(n+1));
    

Formula

a(n) = A000120(A000108(n)).
Two formulas from Luca and Shparlinski (2011):
a(n) >= 3 for all but finitely many positive integers n.
a(n) >> eps(n) * sqrt(log(n)), for all n <= X with at most o(X) exceptions as X -> oo, where eps(n) is a function tending to zero as n -> oo.
Conjecture: Sum_{k=1..n} a(k) ~ n^2 / 2 (see the plot in the Links section).

A379153 The binary weights of the Apéry numbers (A005259).

Original entry on oeis.org

1, 2, 3, 6, 6, 14, 15, 15, 20, 19, 23, 23, 27, 34, 35, 44, 40, 36, 40, 44, 41, 48, 52, 62, 64, 66, 57, 66, 72, 79, 71, 75, 77, 78, 79, 78, 88, 86, 92, 100, 103, 103, 92, 116, 96, 116, 117, 113, 129, 117, 123, 128, 123, 126, 130, 133, 129, 142, 147, 134, 135, 148
Offset: 0

Views

Author

Amiram Eldar, Dec 17 2024

Keywords

Crossrefs

Similar sequences: A011373, A079584, A082481, A379151, A379152.

Programs

  • Mathematica
    a[n_] := DigitCount[Sum[(Binomial[n, k] * Binomial[n+k, k])^2, {k, 0, n}], 2, 1]; Array[a, 100, 0]
  • PARI
    a(n) = hammingweight(sum(k=0, n, (binomial(n, k)*binomial(n+k, k))^2));

Formula

a(n) = A000120(A005259(n)).
a(n) > c * (log(n)/log(log(n)))^(1/4) holds on a set of n of asymptotic density 1, where c > 0 is a constant (Luca and Shparlinski, 2010).
a(n) > c * log(n)/log(log(n)) holds on a set of n of asymptotic density 1, where c > 0 is a constant (Knopfmacher and Luca, 2012).
Conjecture: Limit_{m->oo} (1/m^2) * Sum_{k=1..m} a(k) = log(sqrt(2) + 1)/log(2) = 1.2715533... (Knopfmacher and Luca, 2012).

A214561 Number of 1's in binary expansion of n^n.

Original entry on oeis.org

1, 1, 1, 4, 1, 6, 6, 11, 1, 14, 11, 20, 10, 28, 23, 33, 1, 31, 27, 41, 26, 49, 36, 59, 16, 58, 41, 68, 37, 62, 51, 83, 1, 79, 61, 88, 58, 97, 85, 98, 53, 115, 96, 116, 63, 123, 96, 128, 41, 138, 105, 144, 90, 163, 128, 164, 81, 172, 148, 181, 124, 167, 134, 201, 1
Offset: 0

Views

Author

Alex Ratushnyak, Jul 21 2012

Keywords

Comments

a(n) + A214562(n) = 1+floor(log_2(n^n)) = 1, 1, 3, 5, 9, 12, 16, 20, 25, 29, 34, 39, 44, 49... is the number of binary digits in n^n. - R. J. Mathar, Jul 22 2012

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local m, r;
          m, r:= n^n, 0;
          while m>0 do r:= r +irem(m, 2, 'm') od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 21 2012
  • Mathematica
    Table[Count[IntegerDigits[n^n,2],1],{n,1,64}] (* Geoffrey Critzer, Sep 30 2013 *)
    Join[{1},Table[DigitCount[n^n,2,1],{n,100}]] (* Harvey P. Dale, Oct 13 2022 *)
  • PARI
    vector(66, n, b=binary((n-1)^(n-1)); sum(j=1, #b, b[j])) /* Joerg Arndt, Jul 21 2012 */
  • Python
    for n in range(300):
        c = 0
        b = n**n
        while b>0:
            c += b&1
            b//=2
        print(c, end=',')
    
  • Python
    def a(n): return bin(n**n)[2:].count('1')
    print([a(n) for n in range(65)]) # Michael S. Branicky, May 22 2021
    

Formula

a(n) = A000120(A000312(n)).
a(2^k)=1.

A354300 Numbers k such that k! and (k+1)! have the same binary weight (A000120).

Original entry on oeis.org

0, 1, 3, 5, 7, 8, 12, 13, 15, 31, 63, 88, 127, 129, 131, 244, 255, 262, 263, 288, 300, 344, 511, 793, 914, 1012, 1023, 1045, 1116, 1196, 1538, 1549, 1565, 1652, 1817, 1931, 1989, 2047, 2067, 2096, 2459, 2548, 2862, 2918, 2961, 3372, 3478, 3540, 3588, 3673, 3707
Offset: 1

Views

Author

Amiram Eldar, May 23 2022

Keywords

Comments

Numbers k such that A079584(k) = A079584(k+1).
The corresponding values of A079584(k) are 1, 1, 2, 4, 6, 6, 12, 12, 18, 42, ...
This sequence is infinite as it contains A000225. - Rémy Sigrist, May 23 2022

Examples

			1 is a term since A079584(1) = A079584(2) = 1.
3 is a term since A079584(3) = A079584(4) = 2.
		

Crossrefs

A354301 is a subsequence.

Programs

  • Mathematica
    s[n_] := s[n] = DigitCount[n!, 2, 1]; Select[Range[0, 4000], s[#] == s[# + 1] &]
  • PARI
    isok(k) = hammingweight(k!) == hammingweight((k+1)!); \\ Michel Marcus, May 23 2022
  • Python
    from itertools import count, islice
    def wt(n): return bin(n).count("1")
    def agen(): # generator of terms
        n, fn, fnplus, wtn, wtnplus = 0, 1, 1, 1, 1
        for n in count(0):
            if wtn == wtnplus: yield n
            fn, fnplus = fnplus, fnplus*(n+2)
            wtn, wtnplus = wtnplus, wt(fnplus)
    print(list(islice(agen(), len(data)))) # Michael S. Branicky, May 23 2022
    

A379152 The binary weights of the odd Catalan numbers.

Original entry on oeis.org

1, 1, 2, 6, 16, 25, 60, 127, 244, 494, 1010, 2015, 4076, 8086, 16281, 32818, 65518, 131059, 262348, 524448, 1047643, 2097675, 4194133, 8386693, 16776916, 33554390, 67114125, 134214652, 268452748
Offset: 0

Views

Author

Amiram Eldar, Dec 17 2024

Keywords

Crossrefs

Similar sequences: A011373, A079584, A082481, A379151, A379153.

Programs

  • Mathematica
    a[n_] := DigitCount[CatalanNumber[2^n-1], 2, 1]; Array[a, 23, 0]
  • PARI
    a(n) = my(m = -1 + 1 << n); hammingweight(binomial(2*m, m)/(m+1));
    
  • Python
    from itertools import count, islice
    def A379152_gen(): # generator of terms
        yield from [1,1]
        c, s = 1, 3
        for n in count(2):
            c = (c*((n<<2)-2))//(n+1)
            if n == s:
                yield c.bit_count()
                s = (s<<1)|1
    A379152_list = list(islice(A379152_gen(),10)) # Chai Wah Wu, Dec 17 2024

Formula

a(n) = A000120(A038003(n)) = A000120(A000108(2^n-1)).
a(n) = A379151(2^n-1).

A071425 Total number of 1's in binary representation of all factorials from 1 to n.

Original entry on oeis.org

1, 2, 4, 6, 10, 14, 20, 26, 32, 43, 50, 62, 74, 86, 104, 122, 144, 167, 184, 206, 231, 259, 290, 319, 349, 384, 422, 464, 504, 552, 594, 636, 682, 733, 789, 840, 898, 957, 1021, 1084, 1150, 1214, 1285, 1359, 1429, 1506, 1587, 1676, 1763, 1852, 1942, 2030, 2124
Offset: 1

Views

Author

Labos Elemer, May 27 2002

Keywords

Crossrefs

Partial sums of A079584 starting at index 1.

Programs

  • Mathematica
    s=0; Do[s=s+Apply[Plus, IntegerDigits[n!, 2]]; Print[s], {n, 1, 128}]
    Accumulate[DigitCount[Range[60]!,2,1]] (* Harvey P. Dale, Apr 18 2014 *)
  • PARI
    list(lim) = {my(s = 0); for(k = 1, lim, s += hammingweight(k!); print1(s, ", "));} \\ Amiram Eldar, Mar 18 2025
  • Python
    def A071425(n):
        c, a = 0, 1
        for i in range(1,n+1):
            c += (a:=a*i).bit_count()
        return c # Chai Wah Wu, Nov 12 2024
    

Formula

a(n) = Sum_{i=1..n} A079584(i).

A348651 Number of ones in the binary expansion of (n!)!.

Original entry on oeis.org

1, 1, 1, 4, 29, 293, 2566, 24844, 259437, 2908263, 35102629, 455204360, 6321171774
Offset: 0

Views

Author

Alois P. Heinz, Oct 27 2021

Keywords

Examples

			a(3) = 4 because (3!)! = 6! = 720 = 1011010000_2 which has 4 ones.
		

Crossrefs

Programs

  • Maple
    a:= n-> add(i, i=Bits[Split](n!!)):
    seq(a(n), n=0..10);
  • Mathematica
    a[n_] := DigitCount[(n!)!, 2, 1]; Array[a, 10, 0] (* Amiram Eldar, Oct 29 2021 *)
  • PARI
    a(n) = hammingweight((n!)!); \\ Michel Marcus, Oct 29 2021
  • Python
    from gmpy2 import fac, popcount
    def A348651(n): return popcount(fac(fac(n))) # Chai Wah Wu, Oct 28 2021
    

Formula

a(n) = A000120(A000197(n)).

Extensions

a(11)-a(12) from Chai Wah Wu, Oct 28 2021
Showing 1-10 of 12 results. Next