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.

A356040 a(n) is the smallest integer that has exactly n odious divisors (A227872) and n evil divisors (A356018).

This page as a plain text file.
%I A356040 #38 Jul 26 2022 10:10:01
%S A356040 3,6,12,24,48,96,192,210,252,528,3072,420,12288,2112,1008,840,196608,
%T A356040 2016,786432,1680,4032,33792,12582912,3360,30000,135168,16128,6720,
%U A356040 805306368,19152,3221225472,13440,64512,2162688,120000,26880,206158430208,8650752,258048,31920
%N A356040 a(n) is the smallest integer that has exactly n odious divisors (A227872) and n evil divisors (A356018).
%C A356040 As the number of divisors is even, there is no square in the sequence.
%H A356040 David A. Corneth, <a href="/A356040/b356040.txt">Table of n, a(n) for n = 1..3322</a>
%F A356040 a(n) <= 2^(n-1) * 3.
%F A356040 a(n) = 2^(n-1) * 3 if n is prime. - _David A. Corneth_, Jul 24 2022
%F A356040 a(n) >= A005179(2*n). - _Michael S. Branicky_, Jul 24 2022
%e A356040 48 has ten divisors, five of which are odious {1, 2, 4, 8, 16} as they have an odd number of 1's in their binary expansion: 1, 10, 100, 1000 and 10000; the five other divisors are evil {3, 6, 12, 24, 48} as they have an even number of 1's in their binary expansion: 11, 110, 1100, 11000 and 110000; also, no positive integer smaller than 48 has five divisors that are evil and five divisors that are odious, hence a(5) = 48.
%t A356040 f[n_] := DivisorSum[n, {1, (-1)^DigitCount[#, 2][[1]]} &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i, d}, While[c < len && n < nmax, i = f[n]; If[i[[2]] == 0, d = i[[1]]/2; If[d <= len && s[[d]] == 0, c++; s[[d]] = n]]; n++]; s]; seq[16, 10^6] (* _Amiram Eldar_, Jul 24 2022 *)
%o A356040 (PARI) a(n) = if(isprime(n), return(2^(n-1)*3)); forfactored(i=1, 2^(n-1)*3, if(numdiv(i[2]) == 2*n, d=divisors(i[2]); if(sum(j=1, #d, isevil(d[j])) == n, return(i[1]))))
%o A356040 isevil(n) = bitand(hammingweight(n), 1) == 0 \\ _David A. Corneth_, Jul 24 2022
%o A356040 (Python)
%o A356040 from sympy import divisors, isprime
%o A356040 from itertools import count, islice
%o A356040 def f(n):
%o A356040     counts = [0, 0]
%o A356040     for d in divisors(n, generator=True):
%o A356040         counts[bin(d).count("1")&1] += 1
%o A356040     return counts[0] if counts[0] == counts[1] else -1
%o A356040 def a(n):
%o A356040     if isprime(n): return 2**(n-1) * 3
%o A356040     return next(k for k in count(1) if f(k) == n)
%o A356040 print([a(n) for n in range(1, 34)]) # _Michael S. Branicky_, Jul 24 2022
%Y A356040 Cf. A000069, A001969, A227872, A356018.
%Y A356040 Cf. A230851, A005179.
%K A356040 nonn,base
%O A356040 1,1
%A A356040 _Bernard Schott_, Jul 24 2022
%E A356040 a(9)-a(37) from _Amiram Eldar_, Jul 24 2022
%E A356040 a(38)-a(40) from _David A. Corneth_, Jul 24 2022