cp's OEIS Frontend

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.

A232112 Denominator of smallest nonnegative fraction of form +- 1 +- 1/2 +- 1/3 ... +- 1/n.

Original entry on oeis.org

1, 1, 2, 6, 12, 60, 20, 420, 840, 2520, 2520, 27720, 27720, 360360, 360360, 360360, 144144, 12252240, 12252240, 232792560, 232792560, 232792560, 46558512, 5354228880, 5354228880, 2974571600, 26771144400, 80313433200
Offset: 0

Views

Author

David W. Wilson, Nov 18 2013

Keywords

Comments

Numerators are A232111.

Examples

			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, ...
		

Crossrefs

Cf. A232111.

Programs

  • 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 *)
  • 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