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.

Previous Showing 11-20 of 30 results. Next

A055037 Number of numbers <= n with an even number of prime factors (counted with multiplicity).

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 14, 15, 16, 17, 17, 18, 19, 20, 20, 20, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 25, 26, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 34, 34, 34
Offset: 1

Views

Author

Antreas P. Hatzipolakis (xpolakis(AT)otenet.gr), Jun 01 2000

Keywords

Comments

Partial sums of A065043.

References

  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 92.

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Range[n], EvenQ[PrimeOmega[#]] &]], {n, 75}] (* Alonso del Arte, May 28 2012 *)
    Accumulate[Table[(LiouvilleLambda[n] + 1)/2, {n, 1, 100}]] (* Vaclav Kotesovec, Aug 18 2025 *)
  • PARI
    first(n)=my(s); vector(n,k,s+=1-bigomega(k)%2) \\ Charles R Greathouse IV, Sep 02 2015
    
  • Python
    from functools import reduce
    from operator import ixor
    from sympy import factorint
    def A055037(n): return sum(1 for i in range(1,n+1) if not (reduce(ixor, factorint(i).values(),0)&1)) # Chai Wah Wu, Jan 01 2023

Formula

a(n) = (1/2)*Sum_{k=1..n} (1+lambda(k)) = (1/2)*(n+L(n)), where lambda(n)=A008836(n) and L(n)=A002819(n).

Extensions

Formula and more terms from Vladeta Jovovic, Dec 03 2001
Offset corrected by Ray Chandler, May 30 2012

A072203 (Number of oddly factored numbers <= n) - (number of evenly factored numbers <= n).

Original entry on oeis.org

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

Views

Author

Bill Dubuque (wgd(AT)zurich.ai.mit.edu), Jul 03 2002

Keywords

Comments

A number m is oddly or evenly factored depending on whether m has an odd or even number of prime factors, e.g., 12 = 2*2*3 has 3 factors so is oddly factored.
Polya conjectured that a(n) >= 0 for all n, but this was disproved by Haselgrove. Lehman gave the first explicit counterexample, a(906180359) = -1; the first counterexample is at 906150257 (Tanaka).

References

  • G. Polya, Mathematics and Plausible Reasoning, S.8.16.

Crossrefs

Programs

  • Haskell
    a072203 n = a072203_list !! (n-1)
    a072203_list = scanl1 (\x y -> x + 2*y - 1) a066829_list
    -- Reinhard Zumkeller, Nov 19 2011
    
  • Mathematica
    f[n_Integer] := Length[Flatten[Table[ #[[1]], {#[[2]]}] & /@ FactorInteger[n]]]; g[n_] := g[n] = g[n - 1] + If[ EvenQ[ f[n]], -1, 1]; g[1] = 0; Table[g[n], {n, 1, 103}]
    Join[{0},Accumulate[Rest[Table[If[OddQ[PrimeOmega[n]],1,-1],{n,110}]]]] (* Harvey P. Dale, Mar 10 2013 *)
    Table[1 - Sum[(-1)^PrimeOmega[i], {i, 1, n}], {n, 1, 100}] (* Indranil Ghosh, Mar 17 2017 *)
  • PARI
    a(n) = 1 - sum(i=1, n, (-1)^bigomega(i));
    for(n=1, 100, print1(a(n),", ")) \\ Indranil Ghosh, Mar 17 2017
    
  • Python
    from functools import reduce
    from operator import ixor
    from sympy import factorint
    def A072203(n): return 1+sum(1 if reduce(ixor, factorint(i).values(),0)&1 else -1 for i in range(1,n+1)) # Chai Wah Wu, Dec 20 2022

Formula

a(n) = 1 - A002819(n). - T. D. Noe, Feb 06 2007

Extensions

Edited and extended by Robert G. Wilson v, Jul 13 2002
Comment corrected by Charles R Greathouse IV, Mar 08 2010

A175201 a(n) is the smallest k such that the n consecutive values lambda(k), lambda(k+1), ..., lambda(k+n-1) = 1, where lambda(m) is the Liouville function A008836(m).

Original entry on oeis.org

1, 9, 14, 33, 54, 140, 140, 213, 213, 1934, 1934, 1934, 35811, 38405, 38405, 200938, 200938, 389409, 1792209, 5606457, 8405437, 8405437, 8405437, 8405437, 68780189, 68780189, 68780189, 68780189, 880346227, 880346227, 880346227, 880346227, 880346227
Offset: 1

Views

Author

Michel Lagneau, Mar 04 2010

Keywords

Comments

Short history of conjecture L(n) <= 0 for all n >= 2 by Deborah Tepper Haimo, where L(n) is the summatory Liouville function A002819(n). 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.

Examples

			a(1) = 1 and L(1) = 1;
a(2) = 9 and L(9) = L(10)= 1;
a(3) = 14 and L(14) = L(15) = L(16) = 1;
a(4) = 33 and L(33) = L(34) = L(35) = L(36) = 1.
		

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.

Crossrefs

Programs

  • Maple
    with(numtheory):for k from 0 to 30 do : indic:=0:for n from 1 to 1000000000 while (indic=0)do :s:=0:for i from 0 to k do :if (-1)^bigomega(n+i)= 1 then s:=s+1: else fi:od:if s=k+1 and indic=0 then print(n):indic:=1:else fi:od:od:
  • Mathematica
    Table[k=1;While[Sum[LiouvilleLambda[k+i],{i,0,n-1}]!=n,k++];k,{n,1,30}]
    With[{c=LiouvilleLambda[Range[841*10^4]]},Table[SequencePosition[c,PadRight[ {},n,1],1][[All,1]],{n,24}]//Flatten] (* The program generates the first 24 terms of the sequence. *) (* Harvey P. Dale, Jul 27 2022 *)

Formula

lambda(n) = (-1)^omega(n) where omega(n) is the number of prime factors of n with multiplicity.

A090410 Values of L(10^n), where L(n) is the summatory function of the Liouville function A008836(n).

Original entry on oeis.org

1, 0, -2, -14, -94, -288, -530, -842, -3884, -25216, -116026, -342224, -522626, -966578, -7424752, -29445104, -97617938, -271676470, -618117940, -810056106, -6260758462, -34541748676
Offset: 0

Views

Author

Eric W. Weisstein, Nov 30 2003

Keywords

Comments

L(n) for n <= 10^13 is always negative from 906488081 to 10^13. It reaches a record negative value of -3458310 at 8196557476890. It reaches a record positive value of 829 at 906316571 (A051470(829)). - Donovan Johnson, Mar 08 2011

Crossrefs

Programs

  • PARI
    a(n) = sum(i=1, 10^n, (-1)^bigomega(i)); \\ Michel Marcus, Sep 29 2015

Formula

a(n) = A002819(10^n). - Ray Chandler, May 30 2012

Extensions

a(9)-a(13) from Donovan Johnson, Mar 08 2011
a(14)-a(17) from Hiroaki Yamanouchi, Jul 13 2014
a(18) from Henri Lifchitz, Dec 01 2014
a(19) from Hiroaki Yamanouchi, Sep 28 2015
a(20)-a(21) from Henri Lifchitz, Nov 08 2024

A239122 Partial sums of A061019.

Original entry on oeis.org

1, -1, -4, 0, -5, 1, -6, -14, -5, 5, -6, -18, -31, -17, -2, 14, -3, -21, -40, -60, -39, -17, -40, -16, 9, 35, 8, -20, -49, -79, -110, -142, -109, -75, -40, -4, -41, -3, 36, 76, 35, -7, -50, -94, -139, -93, -140, -188, -139, -189, -138, -190, -243, -189, -134
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 10 2014

Keywords

Crossrefs

Cf. A002819.

Programs

  • Haskell
    a239122 n = a239122_list !! (n-1)
    a239122_list = scanl1 (+) a061019_list
    
  • Mathematica
    Accumulate[Table[n*(-1)^PrimeOmega[n],{n,70}]] (* Harvey P. Dale, Apr 02 2015 *)
  • Python
    from functools import reduce
    from operator import ixor
    from sympy import factorint
    def A239122(n): return sum(-i if reduce(ixor, factorint(i).values(), 0)&1 else i for i in range(1,n+1)) # Chai Wah Wu, Jan 03 2023

A253174 For a permutation of the positive integers B={b(k)}, denote L_B(n) = Sum_{k=1..n} lambda(b(k)), where lambda(n) is Liouville's function (A008836). In this sequence, a(n) = L_B(n) in case B = A098550.

Original entry on oeis.org

1, 0, -1, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 5, 4, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 7, 8, 9, 8, 7, 6, 7, 6, 7, 8, 9, 8, 7, 6, 7, 6, 5, 6, 7, 8, 9, 10, 9, 8, 9, 10, 11, 10, 9, 10, 11, 12, 13, 14, 13, 14, 13, 12, 13, 12, 11, 10, 11, 10, 9, 8, 9, 10, 9, 8, 9, 10, 11, 12, 11, 10, 9, 10, 11, 12, 13, 12
Offset: 1

Views

Author

Vladimir Shevelev, Jan 08 2015

Keywords

Comments

Let n = p^a*q^b*...r^c be the prime power factorization of b(n). Then lambda(n) is
(-1)^s, where s is the sum of exponents a + b + ... + c.
In case B=A000027 (the natural numbers), G. Polya (1919) conjectured that L_B(n)<=0, for n>=2. But this was disproved in 1958 by B. Haselgrove, and in 1980 M. Tanaka found the smallest counterexample, 906150257.
However, for this sequence we conjecture that a(n)>=0 for all n other than 3. A reason for our conjecture is the later appearance of primes in A098550 than in A000027. By our conjecture, among the first N terms of A098550, the terms with odd s are never in the majority, if N is other than 3. Peter J. C. Moses verified the conjecture up to 2.5*10^5 and, moreover, in this range a(n)>0 for n>6.

Crossrefs

Programs

  • Mathematica
    (* b = A098550 *) b[n_ /; n <= 3] := n; b[n_] := b[n] = For[bb = Table[b[j], {j, 1, n-1}]; k=4, True, k++, If[FreeQ[bb, k] && !CoprimeQ[k, b[n-2]] && CoprimeQ[k, b[n-1]], Return[k]]]; a[1]=1; a[n_] := a[n] = a[n-1] + LiouvilleLambda[b[n]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 13 2015 *)

Formula

a(n+1) - a(n) = lambda(A098550(n+1)).

A360659 a(n) is the minimum sum of a completely multiplicative sign sequence of length n.

Original entry on oeis.org

0, 1, 0, -1, 0, -1, 0, -1, -2, -1, 0, -1, -2, -3, -4, -3, -2, -3, -4, -5, -4, -5, -4, -5, -6, -5, -6, -7, -8, -9, -8, -9, -8, -7, -8, -7, -6, -7, -8, -7, -8, -9, -10, -11, -12, -13, -14, -15, -14, -13, -12, -13, -14, -15, -14, -13, -14, -15, -16, -17, -18, -19
Offset: 0

Views

Author

Bartlomiej Pawlik, Feb 15 2023

Keywords

Comments

A completely multiplicative sign sequence is a sequence S of numbers -1 and +1 such that S(a*b) = S(a)*S(b).
Directly from the definition, the first term of every multiplicative sign sequence is +1.
The number of completely multiplicative sign sequences of length n is 2^A000720(n), since every multiplicative sign sequence S is uniquely determined by the values of S on prime indexes.
Liouville's function A002819(n) gives the sum of the multiplicative sign sequence of length n in which every prime is assigned the value of -1. This is, therefore, an upper bound on a(n). The first difference occurs at n = 14.
Conjecture: For every n >= 22 there exists completely multiplicative sign sequence of length n with the minimal sum, which have +1's on initial primes and -1's on the remaining primes, i.e., its subsequence on primes is ++...+--...- for some number of +1's.
First differences are either 1 or -1. This is because optimum sequences for n cannot have a sum less than one less than those for n-1 and similarly optimum sequences for n cannot have a sum greater than one more than those for n-1. A zero difference is not possible because terms alternate between even and odd. - Andrew Howroyd, Feb 16 2023
Liouville's function (A002819) is unbounded below, hence this sequence is also unbounded below and every negative number occurs in the sequence. - Rémy Sigrist, Feb 17 2023
From David A. Corneth, May 28 2024: (Start)
One might ease the search by setting values with prime indices in (n/2, n] to -1 in the multiplicative function.
Furthermore one can use the squarefree part of n to evaluate the value of composites in the sequence. For example the value of index 60 has the same value as the one at index 15. (End)

Examples

			There are eight completely multiplicative sign sequences of length 5: +--+-, +--++, +-++-, +-+++, ++-+-, ++-++, ++++- and +++++. The sums of those sequences are, respectively, -1, 1, 1, 3, 1, 3, 3 and 5. Hence, the minimum sum is equal to -1 and so a(5) = -1.
		

Crossrefs

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)))); m} \\ Andrew Howroyd, Feb 16 2023
    
  • Python
    from itertools import product
    from sympy import primerange, primepi, factorint
    def A360659(n):
        a = dict(zip(primerange(n+1),range(c:=primepi(n))))
        return (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))<<1)-n # Chai Wah Wu, May 31 2024

Formula

a(n) <= A002819(n).
Conjecture: a(n) < A002819(n) for n > 20.
|a(n) - a(n-1)| = 1 for n > 0. - Andrew Howroyd, Feb 16 2023
From David A. Corneth, May 28 2024: (Start)
a(k^2) = a(k^2-1) + 1 for k >= 1.
a(p) = a(p-1) - 1 for prime p. (End)

A069545 Liouville clusters: the number of successive occurrences of signs in Liouville function lambda(k); a(2n-1) is number of successive positive signs, while a(2n) is number of successive negative signs.

Original entry on oeis.org

1, 2, 1, 1, 1, 2, 2, 3, 3, 4, 2, 1, 3, 6, 4, 1, 3, 5, 1, 2, 1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 2, 3, 1, 4, 1, 2, 1, 3, 2, 1, 5, 1, 2, 1, 4, 3, 1, 3, 1, 1, 1, 4, 1, 3, 1, 2, 2, 1, 3, 2, 1, 2, 1, 2, 5, 3, 7, 3, 1, 1, 1, 2, 2, 1, 4, 4, 1, 2, 1, 7, 2
Offset: 1

Views

Author

Paul D. Hanna, Apr 17 2002

Keywords

Comments

Related open questions. What is the limit of ratio: a(n)/n, as n->infinity? What is frequency distribution of integer k in the sequence; a(n)=k for what set of n?
Essentially this sequence is a run-length encoding of A008836. - Alonso del Arte, Feb 29 2012

Examples

			a(6) = 2 because the 6th Liouville cluster consists of 2 successive negative signs: lambda(7) = lambda(8) = (-1).
a(7) = 2 because the 7th Liouville cluster consists of 2 successive positive signs: lambda(9) = lambda(10) = 1.
		

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.

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a069545 n = a069545_list !! (n-1)
    a069545_list = map length $ group a008836_list
    -- Reinhard Zumkeller, Mar 10 2014
  • Mathematica
    max = 227; lambdaClLens = {}; Module[{curr = 1, cl = 1, iter = 2}, While[iter < max, If[LiouvilleLambda[iter] == curr, cl++, AppendTo[lambdaClLens, cl]; curr = (-1)curr; cl = 1]; iter++]]; lambdaClLens (* Alonso del Arte, Feb 29 2012 *)
    Length/@Split[LiouvilleLambda[Range[300]]] (* Harvey P. Dale, Jul 02 2017 *)

Formula

Related to summatory Liouville function (A002819): L(m)=sum_{k=1, n} (-1)^(k-1)*a(k) where m=sum_{k=1, n} a(k).

Extensions

Corrected a(46) and a(47), and added terms after that. - Alonso del Arte, Feb 29 2012

A175202 a(n) is the smallest k such that the n consecutive values L(k), L(k+1), ..., L(k+n-1) = -1, where L(m) is the Liouville function A008836(m).

Original entry on oeis.org

2, 2, 11, 17, 27, 27, 170, 279, 428, 5879, 5879, 13871, 13871, 13871, 41233, 171707, 1004646, 1004646, 1633357, 5460156, 11902755, 21627159, 21627159, 38821328, 41983357, 179376463, 179376463, 179376463, 179376463, 179376463, 179376463, 179376463
Offset: 1

Views

Author

Michel Lagneau, Mar 04 2010

Keywords

Comments

L(n) = (-1)^omega(n) where omega(n) is the number of prime factors of n with multiplicity.

Examples

			a(1) = 2 and L(2) = -1;
a(2) = 2 and L(2) = L(3)= -1;
a(3) = 11 and L(11) = L(12) = L(13) = -1;
a(4) = 17 and L(17) = L(18) = L(19) = L(20) = -1.
		

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.

Crossrefs

Programs

  • Maple
    with(numtheory):for k from 0 to 30 do : indic:=0:for n from 1 to 1000000000 while (indic=0)do :s:=0:for i from 0 to k do :if (-1)^bigomega(n+i)= -1 then s:=s+1: else fi:od:if s=k+1 and indic=0 then print(n):indic:=1:else fi:od:od:
  • Mathematica
    Table[k=1;While[Sum[LiouvilleLambda[k+i],{i,0,n-1}]!=-n,k++];k,{n,1,30}]

Extensions

a(15) and a(21) corrected by Donovan Johnson, Apr 01 2013

A212496 a(n) = Sum_{k=1..n} (-1)^(k-Omega(k)) with Omega(k) the total number of prime factors of k (counted with multiplicity).

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, May 19 2012

Keywords

Comments

On May 16 2012, Zhi-Wei Sun conjectured that a(n) is positive for each n > 4. He has verified this for n up to 10^10, and shown that the conjecture implies the Riemann Hypothesis. Moreover, he guessed that a(n) > sqrt(n) for any n > 324 (and also a(n) < sqrt(n)*log(log(n)) for n > 5892); this implies that the sequence contains all natural numbers.
Sun also conjectured that b(n) = Sum_{k=1..n} (-1)^(k-Omega(k))/k < 0 for all n=1,2,3,..., and verified this for n up to 2*10^9. Moreover, he guessed that b(n) < -1/sqrt(n) for all n > 1, and b(n) > -log(log(n))/sqrt(n) for n > 2008.

Examples

			We have a(4)=0 since (-1)^(1-Omega(1)) + (-1)^(2-Omega(2)) + (-1)^(3-Omega(3)) + (-1)^(4-Omega(4)) = -1 - 1 + 1 + 1 = 0.
		

Crossrefs

Programs

  • Maple
    ListTools:-PartialSums([seq((-1)^(k-numtheory:-bigomega(k)),k=1..60)]); # Robert Israel, Jan 03 2023
  • Mathematica
    PrimeDivisor[n_]:=Part[Transpose[FactorInteger[n]],1]
    Omega[n_]:=If[n==1,0,Sum[IntegerExponent[n,Part[PrimeDivisor[n],i]],{i,1,Length[PrimeDivisor[n]]}]]
    s[0]=0
    s[n_]:=s[n]=s[n-1]+(-1)^(n-Omega[n])
    Do[Print[n," ",s[n]],{n,1,100000}]
    Accumulate[Table[(-1)^(n-PrimeOmega[n]),{n,1000}]] (* Harvey P. Dale, Oct 07 2013 *)
  • PARI
    a(n)=sum(k=1,n, (-1)^(bigomega(k)+k)) \\ Charles R Greathouse IV, Jul 31 2016
    
  • Python
    from functools import reduce
    from operator import ixor
    from sympy import factorint
    def A212496(n): return sum(-1 if reduce(ixor, factorint(i).values(),i)&1 else 1 for i in range(1,n+1)) # Chai Wah Wu, Jan 03 2023
Previous Showing 11-20 of 30 results. Next