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.

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

This page as a plain text file.
%I A333073 #9 Apr 02 2020 19:04:08
%S A333073 1,2,6,6,30,20,140,140,210,42,462,462,12012,3432,6006,6006,87516,
%T A333073 87516,1108536,3048474,2586584,2586584,44618574,44618574,60843510,
%U A333073 17160990,17160990,14263680,782050830,782050830,3806842470,3806842470,16830250920,16830250920
%N A333073 Least k such that Sum_{i=1..n} (-k)^i / i is a positive integer.
%C A333073 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).
%H A333073 Chai Wah Wu, <a href="/A333073/b333073.txt">Table of n, a(n) for n = 1..60</a>
%F A333073 a(n) <= A034386(n).
%o A333073 (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; }
%o A333073 (Python)
%o A333073 from sympy import primorial, lcm
%o A333073 def A333073(n):
%o A333073     f = 1
%o A333073     for i in range(1,n+1):
%o A333073         f = lcm(f,i)
%o A333073     f = int(f)
%o A333073     glist = []
%o A333073     for i in range(1,n+1):
%o A333073         glist.append(f//i)
%o A333073     m = 1 if n < 2 else primorial(n,nth=False)//primorial(n//2,nth=False)
%o A333073     k = m
%o A333073     while True:
%o A333073         p,ki = 0, -k
%o A333073         for i in range(1,n+1):
%o A333073             p = (p+ki*glist[i-1]) % f
%o A333073             ki = (-k*ki) % f
%o A333073         if p == 0:
%o A333073             return k
%o A333073         k += m # _Chai Wah Wu_, Apr 02 2020
%Y A333073 Cf. A034386, A055773, A333072, A333074.
%K A333073 nonn
%O A333073 1,2
%A A333073 _Jinyuan Wang_, Mar 31 2020