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.

This page as a plain text file.
%I A356018 #28 Aug 07 2022 08:39:19
%S A356018 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,
%T A356018 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,
%U A356018 2,2,1,8,0,0,4,0,1,4,0,5,3,0,1,3,3,2
%N A356018 a(n) is the number of evil divisors (A001969) of n.
%C A356018 a(n) = 0 iff n is in A093696.
%F A356018 a(n) = A000005(n) - A227872(n).
%e A356018 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.
%p A356018 A356018 := proc(n)
%p A356018     local a,d ;
%p A356018     a := 0 ;
%p A356018     for d in numtheory[divisors](n) do
%p A356018         if isA001969(d) then
%p A356018             a := a+1 ;
%p A356018         end if;
%p A356018     end do:
%p A356018     a ;
%p A356018 end proc:
%p A356018 seq(A356018(n),n=1..200) ;  # _R. J. Mathar_, Aug 07 2022
%t A356018 a[n_] := DivisorSum[n, 1 &, EvenQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* _Amiram Eldar_, Jul 23 2022 *)
%o A356018 (Python)
%o A356018 from sympy import divisors
%o A356018 def c(n): return bin(n).count("1")&1 == 0
%o A356018 def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
%o A356018 print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 23 2022
%o A356018 (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
%Y A356018 Cf. A000005, A001969, A093688, A093696 (location of 0s), A227872, A356019, A356020.
%Y A356018 Similar sequences: A083230, A087990, A087991, A332268, A355302.
%K A356018 nonn,easy,base
%O A356018 1,6
%A A356018 _Bernard Schott_, Jul 23 2022
%E A356018 More terms from _David A. Corneth_, Jul 23 2022