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-2 of 2 results.

A002819 Liouville's function L(n) = partial sums of A008836.

Original entry on oeis.org

0, 1, 0, -1, 0, -1, 0, -1, -2, -1, 0, -1, -2, -3, -2, -1, 0, -1, -2, -3, -4, -3, -2, -3, -2, -1, 0, -1, -2, -3, -4, -5, -6, -5, -4, -3, -2, -3, -2, -1, 0, -1, -2, -3, -4, -5, -4, -5, -6, -5, -6, -5, -6, -7, -6, -5, -4, -3, -2, -3, -2, -3, -2, -3, -2, -1, -2, -3, -4, -3, -4, -5, -6, -7, -6, -7, -8, -7, -8, -9, -10, -9, -8, -9, -8, -7, -6
Offset: 0

Views

Author

Keywords

Comments

Short history of conjecture L(n) <= 0 for all n >= 2 by Deborah Tepper Haimo. George Polya conjectured 1919 that L(n) <= 0 for all n >= 2. The conjecture was generally deemed true for nearly 40 years, until 1958, when C. B. Haselgrove proved that L(n) > 0 for infinitely many n. In 1962, R. S. Lehman found that L(906180359) = 1 and in 1980, M. Tanaka discovered that the smallest counterexample of the Polya conjecture occurs when n = 906150257. - Harri Ristiniemi (harri.ristiniemi(AT)nicf.), Jun 23 2001
Prime number theorem is equivalent to a(n)=o(n). - Benoit Cloitre, Feb 02 2003
All integers appear infinitely often in this sequence. - Charles R Greathouse IV, Aug 20 2016
In the Liouville function, every prime is assigned the value -1, so it may be expected that the values of a(n) are minimal (A360659) among all completely multiplicative sign functions. As it turns out, this is the case for n < 14 and n = 20. For any other n < 500 there exists a completely multiplicative sign function with a sum less than that of the Liouville function. Conjecture: A360659(n) < a(n) for n > 20. - Bartlomiej Pawlik, Mar 05 2023

References

  • H. Gupta, On a table of values of L(n), Proceedings of the Indian Academy of Sciences. Section A, 12 (1940), 407-409.
  • H. Gupta, A table of values of Liouville's function L(n), Research Bulletin of East Panjab University, No. 3 (Feb. 1950), 45-55.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a002819 n = a002819_list !! n
    a002819_list = scanl (+) 0 a008836_list
    -- Reinhard Zumkeller, Nov 19 2011
    
  • Maple
    A002819 := n -> add((-1)^numtheory[bigomega](i),i=1..n): # Peter Luschny, Sep 15 2011
  • Mathematica
    Accumulate[Join[{0},LiouvilleLambda[Range[90]]]] (* Harvey P. Dale, Nov 08 2011 *)
  • PARI
    a(n)=sum(i=1,n,(-1)^bigomega(i))
    
  • PARI
    a(n)=my(v=vectorsmall(n,i,1)); forprime(p=2,sqrtint(n), for(e=2,logint(n,p), forstep(i=p^e, n, p^e, v[i]*=-1))); forprime(p=2,n, forstep(i=p, n, p, v[i]*=-1)); sum(i=1,#v,v[i]) \\ Charles R Greathouse IV, Aug 20 2016
    
  • Python
    from functools import reduce
    from operator import ixor
    from sympy import factorint
    def A002819(n): return sum(-1 if reduce(ixor, factorint(i).values(),0)&1 else 1 for i in range(1,n+1)) # Chai Wah Wu, Dec 19 2022

Formula

a(n) = determinant of A174856. - Mats Granvik, Mar 31 2010
a(n) = Sum_{k=1..floor(sqrt(n))} A002321(floor(n / k^2)). - Daniel Suteu, May 30 2025

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Jul 09 2001

A373114 Cardinality of the largest subset of {1,...,n} such that no odd number of terms from this subset multiply to a square.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8, 9, 9, 9, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, 31, 32, 33, 34, 34, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 42, 43, 44, 45, 46, 46, 47
Offset: 1

Views

Author

Terence Tao, May 25 2024

Keywords

Examples

			For n=6, {2,3,5} is the largest set without an odd product being a square, so a(6)=3.
		

Crossrefs

Closely related to A360659, A372306, A373119, A373178, A373195.

Programs

  • PARI
    F(n, b)={vector(n, k, my(f=factor(k)); prod(i=1, #f~, if(bittest(b, primepi(f[i, 1])-1), 1, -1)^f[i, 2]))}
    a(n)={my(m=oo); for(b=0, 2^primepi(n)-1, m=min(m, vecsum(F(n, b)))); (n-m)/2} \\ adapted from Andrew Howroyd, Feb 16 2023 at A360659 by David A. Corneth, May 25 2024
  • Python
    import itertools
    import sympy
    def generate_all_completely_multiplicative_functions(primes):
        combinations = list(itertools.product([-1, 1], repeat=len(primes)))
        functions = []
        for combination in combinations:
            func = dict(zip(primes, combination))
            functions.append(func)
        return functions
    def evaluate_function(f, n):
        if n == 1:
            return 1
        factors = sympy.factorint(n)
        value = 1
        for prime, exp in factors.items():
            value *= f[prime] ** exp
        return value
    def compute_minimum_sum(N: int):
        primes = list(sympy.primerange(1, N + 1))
        functions = generate_all_completely_multiplicative_functions(primes)
        min_sum = float("inf")
        for func in functions:
            total_sum = 0
            for n in range(1, N + 1):
                total_sum += evaluate_function(func, n)
            if total_sum < min_sum:
                min_sum = total_sum
        return min_sum
    results = [(N - compute_minimum_sum(N)) // 2 for N in range(1, 12)]
    print(", ".join(map(str, results)))
    
  • Python
    from itertools import product
    from sympy import primerange, primepi, factorint
    def A373114(n):
        a = dict(zip(primerange(n+1),range(c:=primepi(n))))
        return n-min(sum(sum(e for p,e in factorint(m).items() if b[a[p]])&1^1 for m in range(1,n+1)) for b in product((0,1),repeat=c)) # Chai Wah Wu, May 31 2024
    

Formula

n-2*a(n) = A360659(n) (see Footnote 2 of the linked paper of Tao).
Asymptotically, a(n)/n converges to log(1+sqrt(e)) - 2*Integral_{t=1..sqrt(e)} log(t)/(t+1) dt = A246849 ~ 0.828499... (essentially due to Granville and Soundararajan).
a(n+1)-a(n) is either 0 or 1 for any n.
a(n) >= A055038(n).

Extensions

More terms from David A. Corneth, May 25 2024 using b-file from A360659 and formula n-2*a(n) = A360659(n)
Showing 1-2 of 2 results.