login
Smallest difference between consecutive divisors of n.
38

%I #32 Oct 17 2024 16:21:54

%S 1,2,1,4,1,6,1,2,1,10,1,12,1,2,1,16,1,18,1,2,1,22,1,4,1,2,1,28,1,30,1,

%T 2,1,2,1,36,1,2,1,40,1,42,1,2,1,46,1,6,1,2,1,52,1,4,1,2,1,58,1,60,1,2,

%U 1,4,1,66,1,2,1,70,1,72,1,2,1,4,1,78,1,2,1,82,1,4,1,2,1,88,1,6,1,2,1,4

%N Smallest difference between consecutive divisors of n.

%C a(n) = 1 if n is even and a(n) is even if n is odd.

%C a(n) = least m>0 such that n!+1+m and n-m are not relatively prime. - _Clark Kimberling_, Jul 21 2012

%H Reinhard Zumkeller, <a href="/A060680/b060680.txt">Table of n, a(n) for n = 2..10000</a>

%H A. Balog, P. Erdős and G. Tenenbaum, <a href="http://dx.doi.org/10.1007/978-1-4612-3464-7_6">On Arithmetic Functions Involving Consecutive Divisors</a>, In: Analytical Number Theory, pp. 77-90, Birkhäuser, Basel, 1990.

%F a(2n+1) = A060684(n).

%e For n=35, divisors={1,5,7,35}; differences={4,2,28}; a(35) = smallest difference = 2.

%p read("transforms") :

%p A060680 := proc(n)

%p sort(convert(numtheory[divisors](n),list)) ;

%p DIFF(%) ;

%p min(op(%)) ;

%p end proc:

%p seq(A060680(n),n=2..60) ; # _R. J. Mathar_, May 23 2018

%t a[n_] := Min@@(Drop[d=Divisors[n], 1]-Drop[d, -1]);

%t (* Second program: *)

%t a[n_] := Min[Differences[Divisors[n]]];

%t Table[a[n], {n, 2, 100}] (* _Jean-François Alcover_, Oct 16 2024 *)

%o (Haskell)

%o a060680 = minimum . a193829_row -- _Reinhard Zumkeller_, Jun 25 2015

%Y Cf. A060681 (largest difference), A060682, A060683, A060684.

%Y Cf. A193829, A027750.

%K nonn

%O 2,2

%A _Labos Elemer_, Apr 19 2001

%E Corrected by _David W. Wilson_, May 04 2001

%E Edited by _Dean Hickerson_, Jan 22 2002