OFFSET
1,2
LINKS
FORMULA
EXAMPLE
For n=15, its divisors are [1, 3, 5, 15]. If we take the full set [1, 3, 5, 15] and its complement [], their sums are 24 and 0, but gcd(15-0, 24-15) = gcd(15, 9) = 3 > 1. If we take subsets [1] and [3, 5, 15], then their sums are 1 and 23, but gcd(15-1, 23-15) = gcd(14,8) = 2 > 1. If we take subsets [3] and [1, 5, 15], their sums are 3 and 21, but gcd(15-3, 21-15) = gcd(12, 6) = 6 > 1. Only when we take the subset with the four smallest sum, [1, 3] and its complement [5, 15], we get such sums 4 and 20 for which gcd(15-4, 20-15) = gcd(11, 5) = 1. Thus a(15) = 20, the size of the subset with larger sum.
PROG
(PARI)
A325968(n) = { my(divs=divisors(n), s=sigma(n), r, ms=0); for(b=0, (2^(length(divs)))-1, r=sumbybits(divs, b); if(1==gcd(n-(s-r), n-r), ms=max(r, ms))); (ms); };
sumbybits(v, b) = { my(s=0, i=1); while(b>0, s += (b%2)*v[i]; i++; b >>= 1); (s); };
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 29 2019
STATUS
approved