OFFSET
3,1
COMMENTS
a(p) = p-1 for prime p.
LINKS
Robert Israel, Table of n, a(n) for n = 3..10000
MAPLE
F:= proc(n) local p;
p:= min(select(t -> t - n/t > 1, numtheory:-divisors(n)));
p - n/p
end proc:
map(F, [$3..100]); # Robert Israel, Aug 12 2015
MATHEMATICA
sd[n_]:=Min[Select[Abs[#-n/#]&/@Divisors[n], #>1&]]; Array[sd, 90, 3] (* Harvey P. Dale, Sep 28 2013 *)
PROG
(PARI) for(n=3, 100, v=divisors(n); r=sqrt(n); t=0; for(k=1, length(v), if(v[k]>=r, t=k; break)); if(v[t]^2==n, u=t, u=t-1); if(v[t]-v[u]<2, u=u-1; t=t+1); print1(v[t]-v[u]", "))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ralf Stephan, Apr 04 2003
STATUS
approved