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.

Showing 1-1 of 1 results.

A333073 Least k such that Sum_{i=1..n} (-k)^i / i is a positive integer.

Original entry on oeis.org

1, 2, 6, 6, 30, 20, 140, 140, 210, 42, 462, 462, 12012, 3432, 6006, 6006, 87516, 87516, 1108536, 3048474, 2586584, 2586584, 44618574, 44618574, 60843510, 17160990, 17160990, 14263680, 782050830, 782050830, 3806842470, 3806842470, 16830250920, 16830250920
Offset: 1

Views

Author

Jinyuan Wang, Mar 31 2020

Keywords

Comments

Note that the denominator of (Sum_{i=1..n} (-k)^i/i) - (-k)^p/p can never be divisible by p, where n/2 < p <= n. Therefore, for the expression to be an integer, such p must divide k. Thus, a(n) = k is divisible by A055773(n).

Crossrefs

Programs

  • PARI
    a(n) = {my(m = prod(i=primepi(n/2)+1, primepi(n), prime(i)), k = m); while(denominator(sum(i=2, n, (-k)^i/i)) != 1, k += m); k; }
    
  • Python
    from sympy import primorial, lcm
    def A333073(n):
        f = 1
        for i in range(1,n+1):
            f = lcm(f,i)
        f = int(f)
        glist = []
        for i in range(1,n+1):
            glist.append(f//i)
        m = 1 if n < 2 else primorial(n,nth=False)//primorial(n//2,nth=False)
        k = m
        while True:
            p,ki = 0, -k
            for i in range(1,n+1):
                p = (p+ki*glist[i-1]) % f
                ki = (-k*ki) % f
            if p == 0:
                return k
            k += m # Chai Wah Wu, Apr 02 2020

Formula

a(n) <= A034386(n).
Showing 1-1 of 1 results.