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

A066829 Parity of Omega(n): a(n) = 1 if n is the product of an odd number of primes; 0 if product of even number of primes.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0
Offset: 1

Views

Author

G. L. Honaker, Jr., Jan 17 2002

Keywords

Comments

From Reinhard Zumkeller, Jul 01 2009: (Start)
The first N Terms are constructed by the following sieving process:
for j:=1 until N do a(j):=0,
for i:=1 until N/2 do
for j:=2*i step i until N do a(j):=1-a(i). (End)
Omega is also written in the OEIS as bigomega. See also comments, references and formulas in A008836 (Liouville's lambda), A007421 and A065043, that all contain the same information as this sequence. - Antti Karttunen, Apr 30 2022

Examples

			From _Reinhard Zumkeller_, Jul 01 2009: (Start)
Sieve for N = 30, also demonstrating the affinity to the Sieve of Eratosthenes:
[initial] a(j):=0, 1<=j<=30:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[i=1] a(1)=0 --> a(j):=1, 2<=j<=30:
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[i=2] a(2)=1 --> a(2*j):=0, 2<=j<=[30/2]:
0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
[i=3] a(3)=1 --> a(3*j):=0, 2<=j<=[30/3]:
0 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0
[i=4] a(4)=0 --> a(4*j):=1, 2<=j<=[30/4]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 0 1 1 0
[i=5] a(5)=1 --> a(5*j):=0, 2<=j<=[30/5]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 0
[i=6] a(6)=0 --> a(6*j):=1, 2<=j<=[30/6]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 1
[i=7] a(7)=1 --> a(7*j):=0, 2<=j<=[30/7]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 1
[i=8] a(8)=1 --> a(8*j):=0, 2<=j<=[30/8]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 1 1
[i=9] a(9)=0 --> a(9*j):=1, 2<=j<=[30/9]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 0 1 0 1 1
[i=10] a(10)=0 --> a(10*j):=1, 2<=j<=[30/10]:
0 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1
and so on: a(22):=0 in [i=11], a(24):=0 in [i=12], a(26):=0 in [i=13], a(28):=1 in [i=14], and a(30):=1 in [i=15]. (End)
		

Crossrefs

Characteristic function of A026424 (positions of 1's). Cf. also A028260 (its complement, positions of 0's).
Cf. A001222 (bigomega), A007421, A008836, A055038 (partial sums), A065043, A069545 (run lengths), A072203, A349905, A353556, A353558, A358751, A358753.
Cf. A000035.

Programs

  • Haskell
    a066829 = (`mod` 2) . a001222 -- Reinhard Zumkeller, Nov 19 2011
    
  • Maple
    A066829 := proc(n)
        modp(numtheory[bigomega](n) ,2) ;
    end proc:
    seq(A066829(n),n=1..80) ; # R. J. Mathar, Jul 15 2017
  • Mathematica
    Table[(1-LiouvilleLambda[n])/2,{n,1,20}] (* Enrique Pérez Herrero, Jul 07 2012 *)
    Table[If[OddQ[PrimeOmega[n]],1,0],{n,120}] (* Harvey P. Dale, Mar 12 2016 *)
  • PARI
    A066829(n) = (bigomega(n)%2); \\ Simplified by Antti Karttunen, Apr 30 2022
    
  • Python
    from sympy import primeomega as Omega
    def a(n): return Omega(n)%2
    print([a(n) for n in range(1, 105)]) # Michael S. Branicky, Apr 30 2022
    
  • Python
    from operator import ixor
    from functools import reduce
    from sympy import factorint
    def A066829(n): return reduce(ixor, factorint(n).values(),0)&1 # Chai Wah Wu, Jan 01 2023

Formula

a(A026424(n)) = 1; a(A028260(n)) = 0.
Dirichlet g.f.: (zeta(s)^2 - zeta(2*s)) / (2*zeta(s)). [Typo corrected by Vaclav Kotesovec, Jan 30 2024]
a(n) = (1-A008836(n)) / 2. - Corrected by Antti Karttunen, Apr 30 2022
a(m*n) = a(m) XOR a(n). - Reinhard Zumkeller, Aug 28 2008
a(n) = A001222(n) mod 2. - Reinhard Zumkeller, Nov 19 2011
From Antti Karttunen, May 01 & Nov 30 2022: (Start)
a(n) = 1 - A065043(n) = A349905(n) mod 2.
a(n) = A353556(n) + A353558(n).
a(n) = A358751(n) + A358753(n). (End)
a(n) = A000035(A001222(n)). - Omar E. Pol, Apr 09 2025

Extensions

Corrected and comment added by Reinhard Zumkeller, Jun 26 2009

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

A244152 Self-inverse permutation of natural numbers: a(1) = 1; thereafter, if n is k-th number with an odd number of prime divisors (counted with multiplicity) [i.e., n = A026424(k)], a(n) = A028260(1+a(k)), otherwise, when n is k-th number > 1 with an even number of prime divisors [i.e., n = A028260(1+k)], a(n) = A026424(a(k)).

Original entry on oeis.org

1, 4, 10, 2, 24, 7, 6, 55, 18, 3, 16, 15, 121, 44, 12, 11, 39, 9, 36, 35, 105, 31, 250, 5, 29, 28, 93, 26, 25, 86, 22, 82, 238, 79, 20, 19, 81, 72, 17, 68, 218, 65, 517, 14, 62, 67, 60, 202, 195, 57, 59, 56, 185, 477, 8, 52, 50, 175, 51, 47, 177, 45, 495, 167, 42, 161, 46, 40, 162, 169, 150, 38, 143, 455, 459, 140, 153, 1060, 34, 134, 37, 32
Offset: 1

Views

Author

Antti Karttunen, Jul 27 2014

Keywords

Crossrefs

Similar entanglement permutations: A245603-A245604, A235491, A236854, A243347, A244319.

Formula

a(1) = 1, and for n > 1, if A066829(n) = 1, then a(n) = A028260(1 + A244152(A055038(n))), otherwise a(n) = A026424(A244152(A055037(n)-1)).
For all n > 1, A008836(a(n)) = -1 * A008836(n), where A008836 is Liouville's lambda-function.

A245603 Permutation of natural numbers: a(1) = 1; thereafter, if n is k-th number with an odd number of prime divisors (counted with multiplicity) [i.e., n = A026424(k)], a(n) = 2*a(k), otherwise, when n is k-th number > 1 with an even number of prime divisors [i.e., n = A028260(1+k)], a(n) = 1+(2*a(k)).

Original entry on oeis.org

1, 2, 4, 3, 8, 5, 6, 16, 9, 7, 10, 12, 32, 17, 11, 13, 18, 14, 20, 24, 33, 19, 64, 15, 21, 25, 34, 22, 26, 36, 28, 40, 65, 35, 23, 27, 48, 37, 29, 41, 66, 38, 128, 30, 42, 49, 50, 68, 67, 44, 39, 52, 72, 129, 31, 43, 51, 69, 56, 45, 80, 53, 130, 73, 57, 70, 46, 54, 81, 96, 74, 58, 82, 131, 132, 76, 71, 256, 60
Offset: 1

Views

Author

Antti Karttunen, Jul 27 2014

Keywords

Crossrefs

Inverse: A245604.
Similar permutations: A143692, A244152, A244321, A245613, A245605, A245607.

Formula

a(1) = 1, and for n > 1, if A066829(n) = 1, then a(n) = 2 * A245603(A055038(n)), otherwise a(n) = 1 + (2 * A245603(A055037(n)-1)).
As a composition of related permutations:
a(n) = A244321(A245613(n)).
For all n >= 1, A000035(a(n)) = 1 - A066829(n). [Permutation A143692 has the same property.]

A245613 Permutation of natural numbers: a(1) = 1; thereafter, if n is k-th number with an odd number of prime divisors (counted with multiplicity) [i.e., n = A026424(k)], a(n) = A244991(a(k)), otherwise, when n is k-th number > 1 with an even number of prime divisors [i.e., n = A028260(1+k)], a(n) = A244990(1+a(k)).

Original entry on oeis.org

1, 2, 4, 3, 8, 6, 5, 16, 9, 7, 11, 10, 32, 18, 13, 12, 17, 15, 22, 20, 35, 19, 66, 14, 24, 21, 34, 25, 23, 33, 31, 45, 63, 37, 27, 26, 41, 36, 29, 43, 69, 40, 134, 30, 47, 39, 44, 68, 71, 50, 38, 46, 67, 131, 28, 49, 42, 70, 64, 52, 92, 48, 127, 65, 61, 75, 55, 51, 89, 83, 73, 60
Offset: 1

Views

Author

Antti Karttunen, Jul 27 2014

Keywords

Comments

This shares with the permutation A122111 the property that each term of A028260 is mapped to a unique term of A244990 and each term of A026424 is mapped to a unique term of A244991.

Crossrefs

Formula

a(1) = 1, and for n > 1, if A066829(n) = 1, a(n) = A244991(a(A055038(n))), otherwise a(n) = A244990(1+a(A055037(n)-1)).
As a composition of related permutations:
a(n) = A244322(A245603(n)).
For all n >= 1, A066829(n) = A244992(a(n)).

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)

A143692 Permutation of natural numbers: If n is k-th number with an odd number of prime divisors (counted with multiplicity) [i.e., n = A026424(k)], a(n) = 2*k, otherwise, when n is k-th number with an even number of prime divisors [i.e., n = A028260(k)], a(n) = (2*k)-1.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 8, 10, 7, 9, 12, 14, 16, 11, 13, 15, 18, 20, 22, 24, 17, 19, 26, 21, 23, 25, 28, 30, 32, 34, 36, 38, 27, 29, 31, 33, 40, 35, 37, 39, 42, 44, 46, 48, 50, 41, 52, 54, 43, 56, 45, 58, 60, 47, 49, 51, 53, 55, 62, 57, 64, 59, 66, 61, 63, 68, 70, 72, 65, 74, 76, 78
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 29 2008

Keywords

Comments

a(a(n)) = A143694(n).

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a243692 = (+ 1) . fromJust . (`elemIndex` a143691_list)
    -- Reinhard Zumkeller, Aug 07 2014
  • Maple
    N:= 1000: # to get a(1) to a(N)
    Odds,Evens:= selectremove(t -> numtheory:-bigomega(t)::odd,[$1..N]):
    for k from 1 to nops(Odds) do A[Odds[k]]:= 2*k od:
    for k from 1 to nops(Evens) do A[Evens[k]]:= 2*k-1 od:
    seq(A[k],k=1..N); # Robert Israel, Jul 27 2014
  • Mathematica
    m = 100;
    odds = Select[Range[m], OddQ[PrimeOmega[#]]&];
    evens = Select[Range[m], EvenQ[PrimeOmega[#]]&];
    Do[a[odds[[k]]] = 2k, {k, 1, Length[odds]}];
    Do[a[evens[[k]]] = 2k-1, {k, 1, Length[evens]}];
    Array[a, m] (* Jean-François Alcover, Mar 09 2019, from Maple *)

Formula

From Antti Karttunen, Jul 27 2014: (Start)
If A066829(n) = 1, then a(n) = 2 * A055038(n), otherwise a(n) = (2 * A055037(n)) - 1.
For all n >= 1, A000035(a(n)) = 1 - A066829(n). [Permutation A245603 has the same property].
(End)

Extensions

Name changed by Antti Karttunen, Jul 27 2014

A212819 Numbers up to 10^n with an odd number of prime factors, or negative Liouville function.

Original entry on oeis.org

0, 5, 51, 507, 5047, 50144, 500265, 5000421, 50001942, 500012608, 5000058013, 50000171112, 500000261313, 5000000483289
Offset: 0

Views

Author

Martin Renner, May 28 2012

Keywords

Examples

			a(1) = 5 since up to 10 there are the five numbers 2, 3, 5, 7, 8 with an odd number of prime factors or negative Liouville function.
		

Crossrefs

Programs

  • Maple
    zg:=0: zu:=0: G:=[]: U:=[]: k:=0:
    for i from 1 to 10^8 do if numtheory[bigomega](i) mod 2 = 0 then zg:=zg+1: else zu:=zu+1: fi: if i=10^k then G:=[op(G),zg]: U:=[op(U),zu]: k:=k+1: fi: od:
    print(U);
  • Mathematica
    Table[Count[LiouvilleLambda[Range[10^n]], -1], {n, 0, 5}] (* Ray Chandler, May 30 2012 *)

Formula

a(n) = A011557(n) - A212818(n).
a(n) = (10^n)/2 - A090410(n)/2. - Donovan Johnson, May 30 2012
a(n) = A055038(10^n). - Ray Chandler, May 30 2012

Extensions

a(9)-a(13) from Donovan Johnson, May 30 2012

A384210 Number of numbers <= n of the form p * m^2, where p is a prime and m is an integer >= 1.

Original entry on oeis.org

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

Views

Author

Ridouane Oudra, May 22 2025

Keywords

Comments

Partial sums of A358769.
First differs from A055038 at a(30).
a(A229125(n)) = n.

Crossrefs

Programs

  • Maple
    with(numtheory): A358769:=n-> add(nops(factorset(d)), d in divisors(n)) mod 2:
    seq(add(A358769(i), i=1..n), n=1..100);
  • PARI
    a(n) = sum(k=1, n, isprime(core(k))); \\ Michel Marcus, May 29 2025
    
  • Python
    from math import isqrt
    from sympy import primepi
    def A384210(n): return sum(primepi(n//y**2) for y in range(1,isqrt(n)+1)) # Chai Wah Wu, Jun 06 2025

Formula

a(n) = Sum_{i=1..n} A358769(i).
a(n) = Sum_{i=1..floor(sqrt(n))} pi(floor(n/i^2)), where pi = A000720.
a(n) = - Sum_{i=1..n} lambda(i)*omega(i)*floor(n/i), where lambda = A008836 and omega = A001221.
Showing 1-9 of 9 results.