OFFSET
0,3
COMMENTS
Numerators are A232111.
LINKS
David W. Wilson, Table of n, a(n) for n = 0..40
EXAMPLE
1-1/2-1/3-1/4+1/5 = 7/60. No other choice of term signs yields a smaller nonnegative fraction, so a(5) = 60.
0/1, 1/1, 1/2, 1/6, 1/12, 7/60, 1/20, 11/420, 13/840, 11/2520, 11/2520, 23/27720, 23/27720, 607/360360, 251/360360, 251/360360, 25/144144, 97/12252240, ...
MATHEMATICA
nMax = 19; d = {0}; Table[d = Flatten[{d + 1/n, d - 1/n}]; Denominator[Min[Abs[d]]], {n, nMax}] (* T. D. Noe, Nov 20 2013 *)
PROG
(PARI) a(n, t=0)=if(n==1, denominator(abs(n-t)), min(a(n-1, t-1/n), a(n-1, t+1/n))) \\ Charles R Greathouse IV, Apr 06 2014
(Python)
from math import lcm, gcd
from itertools import product
def A232112(n):
if n <= 1: return 1
m = lcm(*range(2, n+1))
mtuple = tuple(m//i for i in range(2, n+1))
return m//gcd(m, min(abs(m+sum(d[i]*mtuple[i] for i in range(n-1))) for d in product((-1, 1), repeat=n-1))) # Chai Wah Wu, Nov 25 2021
CROSSREFS
KEYWORD
nonn,frac
AUTHOR
David W. Wilson, Nov 18 2013
STATUS
approved