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.

A093653 Total number of 1's in binary expansion of all divisors of n.

Original entry on oeis.org

1, 2, 3, 3, 3, 6, 4, 4, 5, 6, 4, 9, 4, 8, 9, 5, 3, 10, 4, 9, 9, 8, 5, 12, 6, 8, 9, 12, 5, 18, 6, 6, 8, 6, 9, 15, 4, 8, 10, 12, 4, 18, 5, 12, 15, 10, 6, 15, 7, 12, 9, 12, 5, 18, 11, 16, 10, 10, 6, 27, 6, 12, 17, 7, 8, 16, 4, 9, 10, 18, 5, 20, 4, 8, 16, 12, 11, 20, 6, 15, 12, 8, 5, 27, 9, 10, 12
Offset: 1

Views

Author

Jason Earls, May 16 2004

Keywords

Examples

			a(8) = 4 because the divisors of 8 are [1, 2, 4, 8] and in binary: 1, 10, 100, 1000, so four 1's.
		

Crossrefs

Cf. A226590 (number of 0's in binary expansion of all divisors of n).
Cf. A182627 (number of digits in binary expansion of all divisors of n).
Cf. A034690 (a decimal equivalent).

Programs

  • Maple
    a:= n-> add(add(i, i=Bits[Split](d)), d=numtheory[divisors](n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, May 17 2022
  • Mathematica
    Table[Plus@@DigitCount[Divisors[n], 2, 1], {n, 75}] (* Alonso del Arte, Sep 01 2013 *)
  • PARI
    A093653(n) = sumdiv(n,d,hammingweight(d)); \\ Antti Karttunen, Dec 14 2017
    
  • PARI
    a(n) = {my(v = valuation(n, 2), n = (n>>v)); sumdiv(n, d, hammingweight(d)) * (v + 1)} \\ David A. Corneth, Feb 15 2023
    
  • Python
    from sympy import divisors
    def a(n): return sum(bin(d).count("1") for d in divisors(n))
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Apr 20 2022
    
  • Python
    from sympy import divisors
    def A093653(n): return sum(d.bit_count() for d in divisors(n, generator=True))
    print([A093653(n) for n in range(1, 88)]) # Michael S. Branicky, Feb 15 2023

Formula

a(n) = Sum_{k = 0..n} if(mod(n, k) = 0, A000120(k), 0). - Paul Barry, Jan 14 2005
a(n) = A182627(n) - A226590(n). - Jaroslav Krizek, Sep 01 2013
a(n) = A292257(n) + A000120(n). - Antti Karttunen, Dec 14 2017
From Bernard Schott, May 16 2022: (Start)
If prime p = A000043(n), then a(2^p-1) = a(A000668(n)) = p+1 = A050475(n).
a(2^n) = n+1 (End)