login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of odious divisors (A000069) of n.
13

%I #45 Aug 17 2022 12:30:25

%S 1,2,1,3,1,2,2,4,1,2,2,3,2,4,1,5,1,2,2,3,3,4,1,4,2,4,1,6,1,2,2,6,2,2,

%T 3,3,2,4,2,4,2,6,1,6,1,2,2,5,3,4,1,6,1,2,3,8,2,2,2,3,2,4,3,7,2,4,2,3,

%U 2,6,1,4,2,4,2,6,3,4,2,5,2,4,1,9,1,2,2

%N Number of odious divisors (A000069) of n.

%H Peter J. C. Moses, <a href="/A227872/b227872.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) + A356018(n) = A000005(n).

%F a(2^n) = n+1. - _Bernard Schott_, Jul 22 2022

%F a(n) = 1 iff n is in A093688. - _Bernard Schott_, Jul 23 2022

%p A227872 := proc(n)

%p option remember ;

%p local a,d ;

%p a := 0 ;

%p for d in numtheory[divisors](n) do

%p if not isA001969(d) then

%p a := a+1 ;

%p end if;

%p end do:

%p a ;

%p end proc:

%p seq(A227872(n),n=1..200) ; # _R. J. Mathar_, Aug 07 2022

%t a[n_] := DivisorSum[n, 1 &, OddQ[DigitCount[#, 2, 1]] &]; Array[a, 100] (* _Amiram Eldar_, Jul 23 2022 *)

%o (PARI) a(n) = sumdiv(n, d, hammingweight(d) % 2); \\ _Michel Marcus_, Feb 06 2016

%o (PARI) isod(n) = hammingweight(n) % 2; \\ A000069

%o a(n) = my(v=valuation(n, 2)); n >>= v; sumdiv(n,d,isod(d)) * (v+1) \\ _David A. Corneth_, Jul 23 2022

%o (Python)

%o from sympy import divisors

%o def c(n): return bin(n).count("1")&1

%o def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))

%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 23 2022

%Y Cf. A000005, A000069, A001969, A093688, A093696, A129771, A330289, A355968, A355969, A227873 (sum odious divs.).

%K nonn,base

%O 1,2

%A _Vladimir Shevelev_, Oct 25 2013

%E More terms from _Peter J. C. Moses_, Oct 25 2013