OFFSET
0,6
COMMENTS
Sequence A231692 includes a proof that a(n) is never 0 for n > 1.
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) = 7.
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}]; Numerator[Min[Abs[d]]], {n, nMax}] (* T. D. Noe, Nov 20 2013 *)
PROG
(PARI) a(n, t=0)=if(n==1, numerator(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 itertools import product
from fractions import Fraction
def A232111(n): return min(x for x in (sum(d[i]*Fraction(1, i+1) for i in range(n)) for d in product((1, -1), repeat=n)) if x >= 0).numerator # Chai Wah Wu, Nov 24 2021
CROSSREFS
KEYWORD
nonn,frac
AUTHOR
David W. Wilson, Nov 18 2013
STATUS
approved