login
A356040
a(n) is the smallest integer that has exactly n odious divisors (A227872) and n evil divisors (A356018).
2
3, 6, 12, 24, 48, 96, 192, 210, 252, 528, 3072, 420, 12288, 2112, 1008, 840, 196608, 2016, 786432, 1680, 4032, 33792, 12582912, 3360, 30000, 135168, 16128, 6720, 805306368, 19152, 3221225472, 13440, 64512, 2162688, 120000, 26880, 206158430208, 8650752, 258048, 31920
OFFSET
1,1
COMMENTS
As the number of divisors is even, there is no square in the sequence.
LINKS
FORMULA
a(n) <= 2^(n-1) * 3.
a(n) = 2^(n-1) * 3 if n is prime. - David A. Corneth, Jul 24 2022
a(n) >= A005179(2*n). - Michael S. Branicky, Jul 24 2022
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(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]))))
isevil(n) = bitand(hammingweight(n), 1) == 0 \\ David A. Corneth, Jul 24 2022
(Python)
from sympy import divisors, isprime
from itertools import count, islice
def f(n):
counts = [0, 0]
for d in divisors(n, generator=True):
counts[bin(d).count("1")&1] += 1
return counts[0] if counts[0] == counts[1] else -1
def a(n):
if isprime(n): return 2**(n-1) * 3
return next(k for k in count(1) if f(k) == n)
print([a(n) for n in range(1, 34)]) # Michael S. Branicky, Jul 24 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jul 24 2022
EXTENSIONS
a(9)-a(37) from Amiram Eldar, Jul 24 2022
a(38)-a(40) from David A. Corneth, Jul 24 2022
STATUS
approved