OFFSET
1,4
LINKS
FORMULA
a(n) = n - A109883(n). - Ridouane Oudra, Jan 25 2024
EXAMPLE
a(12)=10 because the increasingly ordered divisors of 12 are 1,2,3,4,6 and 12, with partial sums 1,3,6,10,16 and 28; the largest partial sum not exceeding 12 is 10.
MAPLE
with(numtheory): a:=proc(n) local div, j: if n=1 then 1 else div:=divisors(n): for j from 1 by 1 while sum(div[i], i=1..j)<=n do sum(div[k], k=1..j) od: fi: end: seq(a(n), n=1..90); # Emeric Deutsch, Apr 01 2006
MATHEMATICA
Table[Last@ TakeWhile[Accumulate@ Divisors@ n, # <= n &], {n, 80}] (* Michael De Vlieger, Oct 30 2017 *)
PROG
(PARI) A117552(n) = { my(divs=divisors(n), s=0); for(i=1, #divs, if((s+divs[i])>n, return(s), s+=divs[i])); s; }; \\ Antti Karttunen, Oct 30 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 28 2006
EXTENSIONS
More terms from Emeric Deutsch, Apr 01 2006
STATUS
approved