login
A325969
a(n) = A325968(n) - n.
6
0, 1, 1, 3, 1, 1, 1, 7, 4, 7, 1, 15, 1, 9, 5, 15, 1, 20, 1, 21, 11, 13, 1, 35, 6, 13, 13, 1, 1, 41, 1, 31, 11, 19, 13, 55, 1, 21, 17, 49, 1, 53, 1, 39, 29, 23, 1, 75, 8, 43, 17, 43, 1, 65, 17, 63, 23, 31, 1, 107, 1, 33, 41, 63, 19, 77, 1, 57, 23, 73, 1, 122, 1, 39, 49, 61, 19, 89, 1, 105, 40, 43, 1, 139, 23, 43, 29, 91, 1, 143, 13, 75, 35, 49
OFFSET
1,4
FORMULA
a(n) = A325968(n) - n = A001065(n) - A325967(n).
a(n) = A325959(n) - A033879(n).
a(A000040(n)) = a(A000396(n)) = 1.
For all n, a(n) <= A325826(n).
PROG
(PARI)
A325967aux(n, ds, s, ms, divs, from=1) = if(1==gcd((s-ds)-n, n-ds), return(ds), for(i=from, #divs, if(ds+divs[i] >= ms, return(ms), ms = min(ms, A325967aux(n, ds+divs[i], s, ms, divs, i+1)))); (ms));
A325967(n) = if(1==gcd(n, sigma(n)), 0, my(divs = List(divisors(n)), s=sigma(n), ms=2*s); fordiv(n, d, if(d>=ms, return(ms), listpop(divs, 1); ms = min(ms, A325967aux(n, d, s, ms, divs)))); (ms));
A325969(n) = ((sigma(n)-n)-A325967(n));
(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); };
A325969(n) = (A325968(n)-n);
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 29 2019
STATUS
approved