%I #25 Nov 24 2021 19:14:20
%S 0,1,1,1,1,7,1,11,13,11,11,23,23,607,251,251,25,97,97,3767,3767,3767,
%T 457,24319,24319,7951,4261,13703,13703,872843,872843,17424097,
%U 13828799,902339,7850449,7850449,7850449,1526171,68185267,3429883,3429883
%N Numerator of smallest nonnegative fraction of form +- 1 +- 1/2 +- 1/3 ... +- 1/n.
%C Sequence A231692 includes a proof that a(n) is never 0 for n > 1.
%e 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.
%e 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, ...
%t 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 *)
%o (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
%o (Python)
%o from itertools import product
%o from fractions import Fraction
%o 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
%Y Cf. A232112 (denominators), A231692.
%K nonn,frac
%O 0,6
%A _David W. Wilson_, Nov 18 2013