OFFSET
1,1
COMMENTS
As the number of divisors is even, there is no square in the sequence.
LINKS
David A. Corneth, Table of n, a(n) for n = 1..3322
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