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

A001221 Number of distinct primes dividing n (also called omega(n)).

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 1, 2, 1, 2, 2, 2, 2, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1, 3, 1, 2, 3, 2, 1, 2, 1, 3, 2
Offset: 1

Views

Author

Keywords

Comments

From Peter C. Heinig (algorithms(AT)gmx.de), Mar 08 2008: (Start)
This is also the number of maximal ideals of the ring (Z/nZ,+,*). Since every finite integral domain must be a field, every prime ideal of Z/nZ is a maximal ideal and since in general each maximal ideal is prime, there are just as many prime ideals as maximal ones in Z/nZ, so the sequence gives the number of prime ideals of Z/nZ as well.
The reason why this number is given by the sequence is that the ideals of Z/nZ are precisely the subgroups of (Z/nZ,+). Hence for an ideal to be maximal it has form a maximal subgroup of (Z/nZ,+) and this is equivalent to having prime index in (Z/nZ) and this is equivalent to being generated by a single prime divisor of n.
Finally, all the groups arising in this way have different orders, hence are different, so the number of maximal ideals equals the number of distinct primes dividing n. (End)
Equals double inverse Mobius transform of A143519, where A051731 = the inverse Mobius transform. - Gary W. Adamson, Aug 22 2008
a(n) is the number of unitary prime power divisors of n (not including 1). - Jaroslav Krizek, May 04 2009 [corrected by Ilya Gutkovskiy, Oct 09 2019]
Sum_{d|n} 2^(-A001221(d) - A001222(n/d)) = Sum_{d|n} 2^(-A001222(d) - A001221(n/d)) = 1 (see Dressler and van de Lune link). - Michel Marcus, Dec 18 2012
Up to 2*3*5*7*11*13*17*19*23*29 - 1 = 6469693230 - 1, also the decimal expansion of the constant 0.01111211... = Sum_{k>=0} 1/(10 ^ A000040(k) - 1) (see A073668). - Eric Desbiaux, Jan 20 2014
The average order of a(n): Sum_{k=1..n} a(k) ~ Sum_{k=1..n} log log k. - Daniel Forgues, Aug 13-16 2015
From Peter Luschny, Jul 13 2023: (Start)
We can use A001221 and A001222 to classify the positive integers as follows.
A001222(n) = A001221(n) = 0 singles out {1}.
Restricting to n > 1:
A001222(n)^A001221(n) = 1: A000040, prime numbers.
A001221(n)^A001222(n) = 1: A246655, prime powers.
A001222(n)^A001221(n) > 1: A002808, the composite numbers.
A001221(n)^A001222(n) > 1: A024619, complement of A246655.
n^(A001222(n) - A001221(n)) = 1: A144338, products of distinct primes. (End)
Inverse Möbius transform of the characteristic function of primes (A010051). - Wesley Ivan Hurt, Jun 22 2024
Dirichlet convolution of A010051(n) and 1. - Wesley Ivan Hurt, Jul 15 2025

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 844.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, pp. 48-57.
  • J. Peters, A. Lodge and E. J. Ternouth, E. Gifford, Factor Table (n<100000) (British Association Mathematical Tables Vol.V), Burlington House/Cambridge University Press London 1935.
  • 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

Cf. A001222 (primes counted with multiplicity), A046660, A285577, A346617. Partial sums give A013939.
Sum of the k-th powers of the primes dividing n for k=0..10: this sequence (k=0), A008472 (k=1), A005063 (k=2), A005064 (k=3), A005065 (k=4), A351193 (k=5), A351194 (k=6), A351195 (k=7), A351196 (k=8), A351197 (k=9), A351198 (k=10).
Sequences of the form n^k * Sum_{p|n, p prime} 1/p^k for k=0..10: this sequence (k=0), A069359 (k=1), A322078 (k=2), A351242 (k=3), A351244 (k=4), A351245 (k=5), A351246 (k=6), A351247 (k=7), A351248 (k=8), A351249 (k=9), A351262 (k=10).

Programs

  • Haskell
    import Math.NumberTheory.Primes.Factorisation (factorise)
    a001221 = length . snd . unzip . factorise
    -- Reinhard Zumkeller, Nov 28 2015
    
  • Julia
    using Nemo
    function NumberOfPrimeFactors(n; distinct=true)
        distinct && return length(factor(ZZ(n)))
        sum(e for (p, e) in factor(ZZ(n)); init=0)
    end
    println([NumberOfPrimeFactors(n) for n in 1:60]) # Peter Luschny, Jan 02 2024
  • Magma
    [#PrimeDivisors(n): n in [1..120]]; // Bruno Berselli, Oct 15 2021
    
  • Maple
    A001221 := proc(n) local t1, i; if n = 1 then return 0 else t1 := 0; for i to n do if n mod ithprime(i) = 0 then t1 := t1 + 1 end if end do end if; t1 end proc;
    A001221 := proc(n) nops(numtheory[factorset](n)) end proc: # Emeric Deutsch
    omega := n -> NumberTheory:-NumberOfPrimeFactors(n, 'distinct'): # Peter Luschny, Jun 15 2025
  • Mathematica
    Array[ Length[ FactorInteger[ # ] ]&, 100 ]
    PrimeNu[Range[120]]  (* Harvey P. Dale, Apr 26 2011 *)
  • MuPAD
    func(nops(numlib::primedivisors(n)), n):
    
  • MuPAD
    numlib::omega(n)$ n=1..110 // Zerinvary Lajos, May 13 2008
    
  • PARI
    a(n)=omega(n)
    
  • Python
    from sympy.ntheory import primefactors
    print([len(primefactors(n)) for n in range(1, 1001)])  # Indranil Ghosh, Mar 19 2017
    
  • Sage
    def A001221(n): return sum(1 for p in divisors(n) if is_prime(p))
    [A001221(n) for n in (1..80)] # Peter Luschny, Feb 01 2012
    
  • SageMath
    [sloane.A001221(n) for n in (1..111)] # Giuseppe Coppoletta, Jan 19 2015
    
  • SageMath
    [gp.omega(n) for n in range(1,101)] # G. C. Greubel, Jul 13 2024
    

Formula

G.f.: Sum_{k>=1} x^prime(k)/(1-x^prime(k)). - Benoit Cloitre, Apr 21 2003; corrected by Franklin T. Adams-Watters, Sep 01 2009
Dirichlet generating function: zeta(s)*primezeta(s). - Franklin T. Adams-Watters, Sep 11 2005
Additive with a(p^e) = 1.
a(1) = 0, a(p) = 1, a(pq) = 2, a(pq...z) = k, a(p^k) = 1, where p, q, ..., z are k distinct primes and k natural numbers. - Jaroslav Krizek, May 04 2009
a(n) = log_2(Sum_{d|n} mu(d)^2). - Enrique Pérez Herrero, Jul 09 2012
a(A002110(n)) = n, i.e., a(prime(n)#) = n. - Jean-Marc Rebert, Jul 23 2015
a(n) = A091221(A091202(n)) = A069010(A156552(n)). - Antti Karttunen, circa 2004 & Mar 06 2017
L.g.f.: -log(Product_{k>=1} (1 - x^prime(k))^(1/prime(k))) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, Jul 30 2018
a(n) = log_2(Sum_{k=1..n} mu(gcd(n,k))^2/phi(n/gcd(n,k))) = log_2(Sum_{k=1..n} mu(n/gcd(n,k))^2/phi(n/gcd(n,k))), where phi = A000010 and mu = A008683. - Richard L. Ollerton, May 13 2021
Sum_{k=1..n} 2^(-a(gcd(n,k)) - A001222(n/gcd(n,k)))/phi(n/gcd(n,k)) = Sum_{k=1..n} 2^(-A001222(gcd(n,k)) - a(n/gcd(n,k)))/phi(n/gcd(n,k)) = 1, where phi = A000010. - Richard L. Ollerton, May 13 2021
a(n) = A005089(n) + A005091(n) + A059841(n) = A005088(n) +A005090(n) +A079978(n). - R. J. Mathar, Jul 22 2021
From Wesley Ivan Hurt, Jun 22 2024: (Start)
a(n) = Sum_{p|n, p prime} 1.
a(n) = Sum_{d|n} c(d), where c = A010051. (End)

A060839 Number of solutions to x^3 == 1 (mod n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 3, 3, 1, 3, 1, 1, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 1, 3, 3, 3, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 1, 3, 1, 1, 3, 1, 3, 1, 3, 3, 1, 1, 1, 3, 3, 9, 1, 3, 1, 3, 1, 1, 3, 1, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 1, 3, 1, 3, 1, 1, 1, 3, 9, 1, 3, 1, 3, 1, 3, 3, 3, 1, 1, 1, 3, 3, 3
Offset: 1

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), May 02 2001

Keywords

Comments

Sum_{k=1..n} a(k) appears to be asymptotic to C*n*log(n) with C = 0.4... - Benoit Cloitre, Aug 19 2002 [C = (11/(6*Pi*sqrt(3))) * Product_{p prime == 1 (mod 3)} (1 - 2/(p*(p+1))) = 0.3170565167... (Finch and Sebah, 2006). - Amiram Eldar, Mar 26 2021]

Examples

			a(7) = 3 because the three solutions to x^3 == 1 (mod 7) are x = 1,2,4.
		

Crossrefs

Cf. A005088, A357905 (base-3 logarithm).
Number of solutions to x^k == 1 (mod n): A060594 (k=2), this sequence (k=3), A073103 (k=4), A319099 (k=5), A319100 (k=6), A319101 (k=7), A247257 (k=8).
Column 3 of A354057.

Programs

  • Maple
    A060839 := proc(n)
        local a,pf,p,r;
        a := 1 ;
        for pf in ifactors(n)[2] do
            p := op(1,pf);
            r := op(2,pf);
            if p = 2 then
                ;
            elif p =3 then
                if r >= 2 then
                    a := a*3 ;
                end if;
            else
                if modp(p,3) = 2 then
                    ;
                else
                    a := 3*a ;
                end if;
            end if;
        end do:
        a ;
    end proc:
    seq(A060839(n),n=1..40) ; # R. J. Mathar, Mar 02 2015
  • Mathematica
    a[n_] := Sum[ If[ Mod[k^3-1, n] == 0, 1, 0], {k, 1, n}]; Table[ a[n], {n, 1, 105}](* Jean-François Alcover, Nov 14 2011, after PARI *)
    f[p_, e_] := If[Mod[p, 3] == 1, 3, 1]; f[3, 1] = 1; f[3, e_] := 3; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Aug 10 2023 *)
  • PARI
    a(n)=sum(i=1,n,if((i^3-1)%n,0,1))
    
  • PARI
    a(n)=my(f=factor(n)); prod(i=1, #f~, if(f[i, 1]==3, 3^min(f[i, 2]-1, 1), if(f[i, 1]%3==1, 3, 1))) \\ Jianing Song, Oct 21 2022
  • Python
    from math import prod
    from sympy import factorint
    def A060839(n): return prod(3 for p, e in factorint(n).items() if (p!=3 or e!=1) and p%3!=2) # Chai Wah Wu, Oct 19 2022
    

Formula

Let b(n) be the number of primes dividing n which are congruent to 1 (mod 3) (sequence A005088); then a(n) is 3^b(n) if n is not divisible by 9 and 3^(b(n) + 1) if n is divisible by 9.
Multiplicative with a(3) = 1, a(3^e) = 3, e >= 2, a(p^e) = 3 for primes p of the form 3k+1, a(p^e) = 1 for primes p of the form 3k+2. - David W. Wilson, May 22 2005 [Corrected by Jianing Song, Oct 21 2022]
If the multiplicative group of integers modulo n has (Z/nZ)* = C_{k_1} X C_{k_2} X ... X C_{k_r}, then a(n) = Product_{i=1..r} gcd(3,k_r). - Jianing Song, Oct 21 2022

A160498 Number of cubic primitive Dirichlet characters modulo n.

Original entry on oeis.org

1, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0
Offset: 1

Views

Author

Steven Finch, May 15 2009

Keywords

Comments

Also called primitive Dirichlet characters of order 3.
Mobius transform of A060839.
C. David, J. Fearnley & H. Kisilevsky prove that Sum_{k=1..n} a(k) ~ C*n, with C = (11*sqrt(3)/(18*Pi)) * Product_{primes p == 1 (mod 3)} (1 - 2/(p*(p+1))) = 0.3170565167922841205670156...; they credit Cohen, F. Diaz y Diaz, & M. Olivier 2002 (see Proposition 5.2. and Corollary 5.3.). - Charles R Greathouse IV, Aug 26 2009 [corrected by Vaclav Kotesovec, Sep 16 2020]
a(n) is the number of primitive Dirichlet characters modulo n such that all entries are 0 or a cubic root of unity: 1, w = (-1 + sqrt(3)*i)/2 or w^2 = (-1 - sqrt(3)*i)/2. - Jianing Song, Feb 27 2019
Every term is 0 or a power of 2. - Jianing Song, Mar 02 2019
From Jianing Song, Apr 03 2021: (Start)
For n >= 2, a(n) is the number of cyclic cubic fields with discriminant n^2. See A343023 for detailed information.
The first occurrence of 2^t is 9*A121940(t-1) for t >= 2. (End)

Examples

			From _Jianing Song_, Mar 02 2019: (Start)
Let w = (-1 + sqrt(3)*i)/2 be one of the primitive 3rd root of unity.
For n = 7, the 2 cubic primitive Dirichlet characters modulo n are [0, 1, w, w^2, w^2, w, 1] and [0, 1, w^2, w, w, w^2, 1], so a(7) = 2.
For n = 9, the 2 cubic primitive Dirichlet characters modulo n are [0, 1, w, 0, w^2, w^2, 0, w, 1] and [0, 1, w^2, 0, w, w, 0, w^2, 1], so a(9) = 2. (End)
		

Crossrefs

Cf. A114643 (number of quadratic primitive Dirichlet characters modulo n), A160499 (number of quartic primitive Dirichlet characters modulo n).
Cf. A060839 (number of solutions to x^3 == 1 (mod n)).

Programs

  • Mathematica
    A060839[n_] := Sum[If[Mod[k^3 - 1, n] == 0, 1, 0], {k, 1, n}]; a[n_] := Sum[ MoebiusMu[n/d]*A060839[d], {d, Divisors[n]}]; Table[a[n], {n, 2, 81}] (* Jean-François Alcover, Jun 19 2013 *)
    f[3, 2] = 2; f[p_, e_] := If[Mod[p, 3] == 1 && e == 1, 2, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Sep 16 2020 *)
  • PARI
    a(n)=sum(d=1, n, if(n%d==0, moebius(n/d)*sum(i=1, d, if((i^3-1)%d, 0, 1)), 0)) \\ Steven Finch, Jun 09 2009
    
  • PARI
    A005088(n)=my(f=factor(n)[,1]); sum(i=1,#f,f[i]%3==1)
    A060839(n)=3^((n%9==0)+A005088(n))
    a(n)=sumdiv(n,d,moebius(n/d)*A060839(d)) \\ Charles R Greathouse IV, Aug 26 2009
    
  • PARI
    a(n) = my(L=factor(n), w=omega(n)); for(i=1, w, if(!((L[i, 1]%3==1 && L[i, 2]==1) || L[i, 1]^L[i, 2] == 9), return(0))); 2^w \\ Jianing Song, Apr 03 2021

Formula

Multiplicative with a(p^e) = 2 if p^e = 9 or p == 1 (mod 3) and e = 1, otherwise 0. - Jianing Song, Mar 02 2019
a(n) = 2*A343023(n) for n >= 2. - Jianing Song, Apr 03 2021

Extensions

a(1) = 1 prepended by Jianing Song, Feb 27 2019

A050931 Numbers having a prime factor congruent to 1 mod 6.

Original entry on oeis.org

7, 13, 14, 19, 21, 26, 28, 31, 35, 37, 38, 39, 42, 43, 49, 52, 56, 57, 61, 62, 63, 65, 67, 70, 73, 74, 76, 77, 78, 79, 84, 86, 91, 93, 95, 97, 98, 103, 104, 105, 109, 111, 112, 114, 117, 119, 122, 124, 126, 127, 129, 130, 133, 134, 139, 140, 143, 146, 147, 148, 151
Offset: 1

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Dec 30 1999

Keywords

Comments

Original definition: Solutions c of cot(2*Pi/3)*(-(a+b+c)*(-a+b+c)*(-a+b-c)*(a+b-c))^(1/2)=a^2+b^2-c^2, c>a,b integers.
Note cot(2*Pi/3) = -1/sqrt(3).
Also the c-values for solutions to c^2 = a^2 + ab + b^2 in positive integers. Also the numbers which occur as the longest side of some triangle with integer sides and a 120-degree angle. - Paul Boddington, Nov 05 2007
The sequence can also be defined as the numbers w which are Heronian means of two distinct positive integers u and v, i.e., w = [u+sqrt(uv)+v]/3. E.g., 28 is the Heronian mean of 4 and 64 (and also of 12 and 48). - Pahikkala Jussi, Feb 16 2008
From Jean-Christophe Hervé, Nov 24 2013: (Start)
This sequence is the analog of hypotenuse numbers A009003 for triangles with integer sides and a 120-degree angle. There are two integers a and b > 0 such that a(n)^2 = a^2 + ab + b^2, and a, b and a(n) are the sides of the triangle: a(n) is the sequence of lengths of the longest side of these triangles. A004611 is the same for primitive triangles.
a and b cannot be equal because sqrt(3) is not rational. Then the values a(n) are such that a(n)^2 is in A024606. It follows that a(n) is the sequence of multiples of primes of form 6k+1 A002476.
The sequence is closed under multiplication. The primitive elements are those with exactly one prime divisor of the form 6k+1 with multiplicity one, which are also those for which there exists a unique 120-degree integer triangle with its longest side equals to a(n).
(End)
Conjecture: Numbers m such that abs(Sum_{k=1..m} [k|m]*A008683(k)*(-1)^(2*k/3)) = 0. - Mats Granvik, Jul 06 2024

Crossrefs

Cf. A002476, A004611, A024606, A230780 (complement), A009003.
Cf. A027748.

Programs

  • Haskell
    a050931 n = a050931_list !! (n-1)
    a050931_list = filter (any (== 1) . map (flip mod 6) . a027748_row) [1..]
    -- Reinhard Zumkeller, Apr 09 2014
    
  • Mathematica
    Select[Range[2,200],MemberQ[Union[Mod[#,6]&/@FactorInteger[#][[All,1]]],1]&] (* Harvey P. Dale, Aug 24 2019 *)
  • PARI
    is_A050931(n)=n>6&&Set(factor(n)[,1]%6)[1]==1 \\ M. F. Hasler, Mar 04 2018

Formula

A005088(a(n)) > 0. Terms are obtained by the products A230780(k)*A004611(p) for k, p > 0, ordered by increasing values. - Jean-Christophe Hervé, Nov 24 2013
cot(2*Pi/3) = -1/sqrt(3) = -0.57735... = - A020760. - M. F. Hasler, Aug 18 2016

Extensions

Simpler definition from M. F. Hasler, Mar 04 2018

A121940 Product of the first n primes of the form 6k+1.

Original entry on oeis.org

7, 91, 1729, 53599, 1983163, 85276009, 5201836549, 348523048783, 25442182561159, 2009932422331561, 194963444966161417, 20081234831514625951, 2188854596635094228659, 277984533772656967039693, 38639850194399318418517327, 5834617379354297081196116377
Offset: 1

Views

Author

Jonathan Vos Post, Sep 03 2006

Keywords

Comments

For n>1, a(n) is the least positive integer that can be primitively represented as m^2+mn+n^2 with 0<=m<=n and gcd(m,n)=1 in exactly 2^(n-1) ways. - Ray Chandler, Oct 01 2007
From Bernard Schott, Mar 30 2021: (Start)
Also, for n >= 1, a(n) is the smallest positive integer m such that m^2 can be primitively represented as k^2-k*q+q^2 with 1 <= k < q and gcd(k,q)= 1 in exactly 2^n ways. For example (a(1))^2 = 7^2 = 3^2 - 3*8 + 8^2 = 5^2 - 5*8 + 8^2.
It follows that a(n) is the smallest middle side b that appears exactly 2^n times consecutively in the data of A335895, for integer-sided triangles whose angles A < B < C are in arithmetic progression. (End)
Also, a(n) is the smallest largest side c that appears exactly 2^(n-1) times consecutively in the data of A357277 for integer-sided triangles with angles A < B < C = 2*Pi/3 = 120 degrees. - Bernard Schott, Oct 21 2022

Examples

			a(4) = 53599 = 7 * 13 * 19 * 31.
		

Crossrefs

Greedy inverse of A005088.

Programs

  • Mathematica
    Rest@FoldList[Times, 1, Select[6 Range[100] + 1, PrimeQ]] (* Ray Chandler, Oct 01 2007 *)
  • PARI
    lista(nn) = {my(pr=1, list=List()); forprime(p=1, nn, if ((p%3) == 1, listput(list,pr *= p));); Vec(list);} \\ Michel Marcus, Jul 17 2020

Formula

a(n) = Product_{i=1..n} A002476(i).

Extensions

Extended by Ray Chandler, Oct 01 2007

A005090 Number of primes == 2 mod 3 dividing n.

Original entry on oeis.org

0, 1, 0, 1, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, 1, 1, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 2, 1, 2, 1, 1, 0, 2, 1, 1, 1, 1, 2, 1, 0, 2, 1, 2, 0, 1, 0, 1, 1, 2, 0, 2, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 0, 2, 0, 2, 1, 1, 2, 1, 1, 2, 1, 2, 0, 2, 0, 2, 1, 1, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 1, 1, 0, 3, 0, 1, 1, 1, 2, 2, 0, 2, 1, 2
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Array[DivisorSum[#, 1 &, And[PrimeQ@ #, Mod[#, 3] == 2] &] &, 120] (* Michael De Vlieger, Jul 11 2017 *)
  • PARI
    a(n) = my(f=factor(n)); sum(k=1, #f~, (f[k,1] % 3) == 2); \\ Michel Marcus, Jul 11 2017
    
  • Python
    from sympy import primefactors
    def a(n): return sum(1 for p in primefactors(n) if p%3==2)
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jul 11 2017
  • Scheme
    (define (A005090 n) (if (= 1 n) 0 (+ (A004526 (modulo (A020639 n) 3)) (A005090 (A028234 n))))) ;; Antti Karttunen, Jul 10 2017
    

Formula

Additive with a(p^e) = 1 if p = 2 (mod 3), 0 otherwise.
From Antti Karttunen, Jul 10 2017: (Start)
a(1) = 0; for n > 1, floor((A020639(n) mod 3)/2) + a(A028234(n)).
a(n) = A001221(n) - A005088(n) - A079978(n).
(End)

Extensions

More terms from Antti Karttunen, Jul 10 2017

A230780 Positive numbers without a prime factor congruent to 1 (mod 6).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 15, 16, 17, 18, 20, 22, 23, 24, 25, 27, 29, 30, 32, 33, 34, 36, 40, 41, 44, 45, 46, 47, 48, 50, 51, 53, 54, 55, 58, 59, 60, 64, 66, 68, 69, 71, 72, 75, 80, 81, 82, 83, 85, 87, 88, 89, 90, 92, 94, 96, 99, 100, 101, 102, 106, 107
Offset: 1

Views

Author

Jean-Christophe Hervé, Nov 23 2013

Keywords

Comments

The sequence is closed under multiplication. Primitive elements are 3 and the primes of form 3*k+2.
a(n)^2 is not expressible as x^2+xy+y^2 with x and y positive integers.
Analog of A004144 (nonhypotenuse numbers) for 120-degree angle triangles: a(n) is not the length of the longest side of such a triangle with integer sides.
It might have been natural to include 0 in this sequence. - M. F. Hasler, Mar 04 2018

Crossrefs

Cf. A002476, A005088, complement of A050931.
Cf. A004144 (analog for 4k+1 primes and right triangles).
Cf. A027748.

Programs

  • Haskell
    a230780 n = a230780_list !! (n-1)
    a230780_list = filter (all (/= 1) . map (flip mod 6) . a027748_row) [1..]
    -- Reinhard Zumkeller, Apr 09 2014
    
  • Mathematica
    Join[{1}, Select[Range[2, 110], ! MemberQ[Union[Mod[Transpose[ FactorInteger[#]][[1]], 6]], 1] &]] (* T. D. Noe, Nov 24 2013 *)
    Join[{1},Select[Range[110],NoneTrue[FactorInteger[#][[All,1]],Mod[#,6] == 1&]&]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Feb 03 2019 *)
  • PARI
    is_A230780(n)=!setsearch(Set(factor(n)[,1]%6),1) \\ M. F. Hasler, Mar 04 2018

Formula

A005088(a(n)) = 0.

A115069 a(n) = 3^b(n), where b(n) is #{primes p=1 mod 3 dividing n}.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 3, 1, 3, 1, 1, 3, 1, 1, 1, 3, 1, 3, 3, 3, 1, 1, 3, 3, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 3, 3, 3, 1, 3, 1, 3, 1, 1, 3, 1, 1, 3, 3, 1, 3, 3, 3, 3, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 9, 1, 3, 1, 3, 1, 3, 3, 1
Offset: 1

Views

Author

Steven Finch, Mar 01 2006

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> 3^add(`if`(irem(i[1], 3)=1, 1, 0), i=ifactors(n)[2](n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 17 2019
  • Mathematica
    b[n_] := Count[FactorInteger[n][[All, 1]], p_ /; Mod[p, 3] == 1];
    a[1] = 1; a[n_] := 3^b[n];
    Table[a[n], {n, 1, 99}] (* Jean-François Alcover, Feb 17 2019 *)
  • PARI
    a(n) = 3^#select(x -> x%3 == 1, factor(n)[,1]); \\ Amiram Eldar, Nov 30 2024

Formula

a(n) = 3^A005088(n). - R. J. Mathar, May 19 2020
From Amiram Eldar, Nov 30 2024: (Start)
Multiplicative with a(p^e) = 3 if p == 1 (mod 3), and 1 otherwise.
Sum_{k=1..n} a(k) ~ (sqrt(3)/(2*Pi)) * c * n * log(n), where c = Product_{primes p == 1 (mod 3)} (1 - 2/(p*(p+1))) = 0.9410349413195354517900322... (Finch and Sebah, 2006). (End)

Extensions

a(1)=1 prepended by Alois P. Heinz, Feb 17 2019
Keyword mult added by Amiram Eldar, Nov 30 2024

A115070 a(n) = phi(n)/3^b(n), where b(n) is #{primes p=1 mod 3 dividing n}.

Original entry on oeis.org

1, 1, 2, 2, 4, 2, 2, 4, 6, 4, 10, 4, 4, 2, 8, 8, 16, 6, 6, 8, 4, 10, 22, 8, 20, 4, 18, 4, 28, 8, 10, 16, 20, 16, 8, 12, 12, 6, 8, 16, 40, 4, 14, 20, 24, 22, 46, 16, 14, 20, 32, 8, 52, 18, 40, 8, 12, 28, 58, 16, 20, 10, 12, 32, 16, 20, 22, 32, 44, 8, 70, 24, 24, 12, 40, 12, 20, 8, 26, 32, 54
Offset: 1

Views

Author

Steven Finch, Mar 01 2006

Keywords

Comments

Cubic analog of A070306. Always an integer.

Crossrefs

Programs

  • Maple
    with(numtheory):
    a:= n-> phi(n)/3^add(`if`(irem(p, 3)=1, 1, 0), p=factorset(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Feb 17 2019
  • Mathematica
    b[n_] := Count[FactorInteger[n][[All, 1]], p_ /; Mod[p, 3] == 1]; b[1] = 0;
    a[n_] := EulerPhi[n]/3^b[n];
    Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Feb 17 2019 *)
    f[p_, e_] := (p - 1)*p^(e - 1)/If[Mod[p, 3] == 1, 3, 1]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 30 2024 *)
  • PARI
    {b(n)=my(f=factor(n)[, 1]); sum(i=1, #f, f[i]%3==1)};
    {a(n)= eulerphi(n)/3^b(n)};
    vector(80, n, a(n)) \\ G. C. Greubel, Feb 17 2019
    
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, (f[i,1]-1)*f[i,1]^(f[i,2]-1)/if(f[i,1] % 3 == 1, 3,1));} \\ Amiram Eldar, Nov 30 2024

Formula

From Amiram Eldar, Nov 30 2024: (Start)
a(n) = A000010(n)/3^A005088(n) = A000010(n)/A115069(n).
Multiplicative with a(p^e) = (p-1)*p^(e-1)/3 if p == 1 (mod 3), and (p-1)*p^(e-1) otherwise. (End)

Extensions

a(1)=1 prepended by Alois P. Heinz, Feb 17 2019
Keyword mult added by Amiram Eldar, Nov 30 2024

A368647 The number of distinct primes of the form 3*k+2 dividing n minus the number of distinct primes of the form 3*k+1 dividing n.

Original entry on oeis.org

0, 1, 0, 1, 1, 1, -1, 1, 0, 2, 1, 1, -1, 0, 1, 1, 1, 1, -1, 2, -1, 2, 1, 1, 1, 0, 0, 0, 1, 2, -1, 1, 1, 2, 0, 1, -1, 0, -1, 2, 1, 0, -1, 2, 1, 2, 1, 1, -1, 2, 1, 0, 1, 1, 2, 0, -1, 2, 1, 2, -1, 0, -1, 1, 0, 2, -1, 2, 1, 1, 1, 1, -1, 0, 1, 0, 0, 0, -1, 2, 0, 2
Offset: 1

Views

Author

Amiram Eldar, Jan 02 2024

Keywords

Crossrefs

Programs

  • Mathematica
    f[p_, e_] := Switch[Mod[p, 3], 0, 0, 1, -1, 2, 1]; a[1] = 0; a[n_] := Plus @@ f @@@ FactorInteger[n]; Array[a, 100]
  • PARI
    a(n) = {my(p = factor(n)[, 1]); sum(i = 1, #p, if(p[i]%3 == 0, 0, if(p[i]%3 == 1, -1, 1)));}

Formula

Additive with a(p^e) = 0 if p = 3, 1 if p == 2 (mod 3), and -1 if p == 1 (mod 3).
a(n) = A005090(n) - A005088(n).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = A086241 = 0.641944... .
Showing 1-10 of 10 results.