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.

A246601 Sum of divisors d of n with property that the binary representation of d can be obtained from the binary representation of n by changing any number of 1's to 0's.

Original entry on oeis.org

1, 2, 4, 4, 6, 8, 8, 8, 10, 12, 12, 16, 14, 16, 24, 16, 18, 20, 20, 24, 22, 24, 24, 32, 26, 28, 40, 32, 30, 48, 32, 32, 34, 36, 36, 40, 38, 40, 43, 48, 42, 44, 44, 48, 60, 48, 48, 64, 50, 52, 72, 56, 54, 80, 61, 64, 58, 60, 60, 96, 62, 64, 104, 64, 66, 68, 68, 72, 70, 72
Offset: 1

Views

Author

N. J. A. Sloane, Sep 06 2014

Keywords

Comments

Equivalently, the sum of the divisors d of n such that the bitwise OR of d and n is equal to n. - Chai Wah Wu, Sep 06 2014
Equivalently, the sum of the divisors d of n such that the bitwise AND of n and d is equal to d. - Amiram Eldar, Dec 15 2022

Examples

			12 = 1100_2; only the divisors 4 = 0100_2 and 12 = 1100_2 satisfy the condition, so(12) = 4+12 = 16.
15 = 1111_2; all divisors 1,3,5,15 satisfy the condition, so a(15)=24.
		

Crossrefs

Programs

  • Maple
    with(numtheory);
    sd:=proc(n) local a,d,s,t,i,sw;
    s:=convert(n,base,2);
    a:=0;
    for d in divisors(n) do
    sw:=-1;
    t:=convert(d,base,2);
    for i from 1 to nops(t) do if t[i]>s[i] then sw:=1; fi; od:
    if sw<0 then a:=a+d; fi;
    od;
    a;
    end;
    [seq(sd(n),n=1..100)];
  • Mathematica
    a[n_] := DivisorSum[n, #*Boole[BitOr[#, n] == n] &]; Array[a, 100] (* Jean-François Alcover, Dec 02 2015, adapted from PARI *)
  • PARI
    a(n) = sumdiv(n, d, d*(bitor(n,d)==n)); \\ Michel Marcus, Sep 07 2014
  • Python
    from sympy import divisors
    def A246601(n):
        return sum(d for d in divisors(n) if n|d == n)
    # Chai Wah Wu, Sep 06 2014
    

Formula

a(2^i) = 2^i.
a(odd prime p) = p+1.
From Amiram Eldar, Dec 15 2022: (Start)
a(2*n) = 2*a(n), and therefore a(m*2^k) = 2^k*a(m) for m odd and k>=0.
a(2^n-1) = sigma(2^n-1) = A075708(n). (End)
a(n) = Sum_{d|n} d*(binomial(n,d) mod 2). - Ridouane Oudra, Apr 09 2025