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.

A356018 a(n) is the number of evil divisors (A001969) of n.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 0, 2, 2, 0, 3, 0, 0, 3, 0, 1, 4, 0, 3, 1, 0, 1, 4, 1, 0, 3, 0, 1, 6, 0, 0, 2, 2, 1, 6, 0, 0, 2, 4, 0, 2, 1, 0, 5, 2, 0, 5, 0, 2, 3, 0, 1, 6, 1, 0, 2, 2, 0, 9, 0, 0, 3, 0, 2, 4, 0, 3, 2, 2, 1, 8, 0, 0, 4, 0, 1, 4, 0, 5, 3, 0, 1, 3, 3, 2
Offset: 1

Views

Author

Bernard Schott, Jul 23 2022

Keywords

Comments

a(n) = 0 iff n is in A093696.

Examples

			12 has 6 divisors: {1, 2, 3, 4, 6, 12} of which three {3, 6, 12} have an even number of 1's in their binary expansion with 11, 110 and 11100 respectively; hence a(12) = 3.
		

Crossrefs

Cf. A000005, A001969, A093688, A093696 (location of 0s), A227872, A356019, A356020.
Similar sequences: A083230, A087990, A087991, A332268, A355302.

Programs

  • Maple
    A356018 := proc(n)
        local a,d ;
        a := 0 ;
        for d in numtheory[divisors](n) do
            if isA001969(d) then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A356018(n),n=1..200) ;  # R. J. Mathar, Aug 07 2022
  • Mathematica
    a[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* Amiram Eldar, Jul 23 2022 *)
  • PARI
    a(n) = my(v = valuation(n, 2)); n>>=v; d=divisors(n); sum(i=1, #d, bitand(hammingweight(d[i]), 1) == 0) * (v+1) \\ David A. Corneth, Jul 23 2022
  • Python
    from sympy import divisors
    def c(n): return bin(n).count("1")&1 == 0
    def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Jul 23 2022
    

Formula

a(n) = A000005(n) - A227872(n).

Extensions

More terms from David A. Corneth, Jul 23 2022