OFFSET
1,1
COMMENTS
Numbers n whose sets of divisors and anti-divisors can each be partitioned into two disjoint sets whose sums are sigma(n)/2 for the sets in the divisors partition and sigma*(n)/2 for the anti-divisors partition, where sigma*(n) is the sum of the anti-divisors of n.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
270-> divisors: 1,2,3,5,6,9,10,15,18,27,30,45,54,90,135,270; sigma(270)/2=360; 1+2+3+5+6+9+10+15+18+27+30+45+54+135=90+270=360.
270-> anti-divisors: 4,7,11,12,20,36,49,60,77,108,180; sigma*(270)/2=282; 4+7+11+20+60+180=12+36+49+77+108=282.
MAPLE
with(combstruct);
with(numtheory);
P:=proc(i)
local S, R, Stop, Comb, a, b, c, d, k, m, n, s;
for n from 3 to i do
a:={};
for k from 2 to n-1 do if abs((n mod k)- k/2) < 1 then a:=a union {k}; fi; od;
b:=nops(a); c:=op(a); s:=0;
if b>1 then for k from 1 to b do s:=s+c[k]; od;
else s:=c;
fi;
if (modp(s, 2)=0 and 2*n<=s) then
S:=1/2*s-n; R:=select(m->m<=S, [c]); Stop:=false; Comb:=iterstructs(Combination(R));
while not (finished(Comb) or Stop) do Stop:=add(d, d=nextstruct(Comb))=S; od;
if Stop then
s:=sigma(n);
if (modp(s, 2)=0 and 2*n<=s) then
S:=1/2*s-n; R:=select(m->m<=S, divisors(n)); Stop:=false; Comb:=iterstructs(Combination(R));
while not (finished(Comb) or Stop) do Stop:=add(d, d=nextstruct(Comb))=S; od;
if Stop then print(n); fi;
fi;
fi;
fi;
od;
end:
P(10000);
PROG
(Python)
from sympy import divisors
from sympy.combinatorics.subsets import Subset
def antidivisors(n):
return [2*d for d in divisors(n) if n > 2*d and n % (2*d)] + \
[d for d in divisors(2*n-1) if n > d >=2 and n % d] + \
[d for d in divisors(2*n+1) if n > d >=2 and n % d]
for n in range(1, 10**3):
d = divisors(n)
s = sum(d)
if not s % 2 and max(d) <= s/2:
for x in range(1, 2**len(d)):
if sum(Subset.unrank_binary(x, d).subset) == s/2:
d = antidivisors(n)
s = sum(d)
if not s % 2 and max(d) <= s/2:
for x in range(1, 2**len(d)):
if sum(Subset.unrank_binary(x, d).subset) == s/2:
print(n, end=', ')
break
break
# Chai Wah Wu, Aug 14 2014
(Python)
from sympy import divisors
import numpy as np
A192274 = []
for n in range(3, 10**3):
d = divisors(n)
s = sum(d)
if not s % 2 and 2*n <= s:
d.remove(n)
s2, ld = int(s/2-n), len(d)
z = np.zeros((ld+1, s2+1), dtype=int)
for i in range(1, ld+1):
y = min(d[i-1], s2+1)
z[i, range(y)] = z[i-1, range(y)]
z[i, range(y, s2+1)] = np.maximum(z[i-1, range(y, s2+1)], z[i-1, range(0, s2+1-y)]+y)
if z[i, s2] == s2:
d2 = [2*x for x in d if n > 2*x and n % (2*x)] + \
[x for x in divisors(2*n-1) if n > x >=2 and n % x] + \
[x for x in divisors(2*n+1) if n > x >=2 and n % x]
s, dmax = sum(d2), max(d2)
if not s % 2 and 2*dmax <= s:
d2.remove(dmax)
s2, ld = int(s/2-dmax), len(d2)
z = np.zeros((ld+1, s2+1), dtype=int)
for i in range(1, ld+1):
y = min(d2[i-1], s2+1)
z[i, range(y)] = z[i-1, range(y)]
z[i, range(y, s2+1)] = np.maximum(z[i-1, range(y, s2+1)], z[i-1, range(0, s2+1-y)]+y)
if z[i, s2] == s2:
A192274.append(n)
break
break
# Chai Wah Wu, Aug 19 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Paolo P. Lava, Jun 28 2011
EXTENSIONS
Corrected entries and comment by Chai Wah Wu, Aug 13 2014
STATUS
approved