This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A082119 #17 Jan 13 2025 06:34:09 %S A082119 1,2,3,4,1,6,2,8,3,10,1,12,5,2,6,16,3,18,1,4,9,22,2,24,11,6,3,28,1,30, %T A082119 4,8,15,2,5,36,17,10,3,40,1,42,7,4,21,46,2,48,5,14,9,52,3,6,1,16,27, %U A082119 58,4,60,29,2,12,8,5,66,13,20,3,70,1,72,35,10,15,4,7,78,2,24,39,82,5 %N A082119 Smallest positive difference between d and n/d for any divisor d of n. %C A082119 a(n) = A056737(n) for nonsquare n. a(p) = p-1 for prime p. %H A082119 Alois P. Heinz, <a href="/A082119/b082119.txt">Table of n, a(n) for n = 2..10000</a> %p A082119 with(numtheory): %p A082119 a:= n-> min(seq((h-> `if`(h>0, h, NULL))(d-n/d), d=divisors(n))): %p A082119 seq(a(n), n=2..100); # _Alois P. Heinz_, Nov 12 2014 %t A082119 a[n_] := Min[Table[If[# > 0, #, Nothing]&[d-n/d], {d, Divisors[n]}]]; %t A082119 Table[a[n], {n, 2, 100}] (* _Jean-François Alcover_, Jan 13 2025, after _Alois P. Heinz_ *) %o A082119 (PARI) a(n) = my(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]<1, u=u-1; t=t+1); v[t]-v[u]; %Y A082119 Cf. A082120, A000037 (nonsquares), A056737. %K A082119 nonn,easy %O A082119 2,2 %A A082119 _Ralf Stephan_, Apr 04 2003