OFFSET
1,1
MAPLE
branch:= proc(m, dm, bestyet)
local t, x, nby, r;
nby:= bestyet;
for t from F[m][2] by -1 to 0 do
x:= dm*F[m][1]^t;
if x >= nby then next
elif x >= c then nby:= x
elif (x*R[m] < c) or (m=nF) then break
else nby:= branch(m+1, x, nby);
fi
od;
nby
end proc:
P:= 17: A[1]:= 17:
for n from 2 to 15 do
c:= ceil(1/2+1/2*sqrt(5+4*P));
while not type(c, integer) do Digits:= 2*Digits; c:= eval(c) od:
F:= ifactors(P)[2]; nF:= nops(F);
F:= sort(F, (s, t)->s[1]>t[1]);
R:= [seq(mul(F[i][1]^F[i][2], i=j+1..nF), j=1..nF)];
d:= branch(1, 1, P);
A[n]:= d - P/d;
P:= P*A[n]
od:
seq(A[n], n=1..15); # Robert Israel, May 20 2015
PROG
(PARI) p=17; print1(p, ", "); for(n=1, 13, r=floor(sqrt(p)); d1=1; d2=1; nE=omega(p); P=factor(p); E=P[, 2]; P=P[, 1]; forvec(v=vector(nE, i, [0, E[i]]), x=prod(k=1, nE, P[k]^v[k]); if(x<=r && x>=d2, d1=d2; d2=x, if(x<=d2 && x>=d1, d1=x))); difer=p/d2-d2; if(difer<=1, difer=p/d1-d1); print1(difer", "); p*=difer)
CROSSREFS
KEYWORD
nonn,hard,more
AUTHOR
Ralf Stephan, Apr 04 2003
EXTENSIONS
a(12) from Herman Jamke (hermanjamke(AT)fastmail.fm), Nov 02 2006
a(13) from Herman Jamke (hermanjamke(AT)fastmail.fm), Nov 14 2006
a(14) and a(15) from Robert Israel, May 20 2015
STATUS
approved