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 42 results. Next

A141128 Sum over unitary prime power divisors p^k of n of A025528(p^k).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Additive with a(p^k) = A025528(p^k).

Crossrefs

Formula

sum_{p^k|n,not p^{k+1}|n,k>0} A025528(p^k).

A000720 pi(n), the number of primes <= n. Sometimes called PrimePi(n) to distinguish it from the number 3.14159...

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Partial sums of A010051 (characteristic function of primes). - Jeremy Gardiner, Aug 13 2002
pi(n) and prime(n) are inverse functions: a(A000040(n)) = n and A000040(n) is the least number m such that A000040(a(m)) = A000040(n). A000040(a(n)) = n if (and only if) n is prime. - Jonathan Sondow, Dec 27 2004
See the additional references and links mentioned in A143227. - Jonathan Sondow, Aug 03 2008
A lower bound that gets better with larger N is that there are at least T prime numbers less than N, where the recursive function T is: T = N - N*Sum_{i=0..T(sqrt(N))} A005867(i)/A002110(i). - Ben Paul Thurston, Aug 23 2010
Number of partitions of 2n into exactly two parts with the smallest part prime. - Wesley Ivan Hurt, Jul 20 2013
Equivalent to the Riemann hypothesis: abs(a(n) - li(n)) < sqrt(n)*log(n)/(8*Pi), for n >= 2657, where li(n) is the logarithmic integral (Lowell Schoenfeld). - Ilya Gutkovskiy, Jul 05 2016
The second Hardy-Littlewood conjecture, that pi(x) + pi(y) >= pi(x + y) for integers x and y with min{x, y} >= 2, is known to hold for (x, y) sufficiently large (Udrescu 1975). - Peter Luschny, Jan 12 2021

Examples

			There are 3 primes <= 6, namely 2, 3 and 5, so pi(6) = 3.
		

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. 870.
  • Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, p. 8.
  • Raymond Ayoub, An Introduction to the Analytic Theory of Numbers, Amer. Math. Soc., 1963; p. 129.
  • Florian Cajori, A History of Mathematical Notations, Dover edition (2012), par. 409.
  • Richard Crandall and Carl Pomerance, Prime Numbers: A Computational Perspective, Springer, NY, 2001; see p. 5.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, Theorems 6, 7, 420.
  • G. J. O. Jameson, The Prime Number Theorem, Camb. Univ. Press, 2003. [See also the review by D. M. Bressoud (link below).]
  • Władysław Narkiewicz, The Development of Prime Number Theory, Springer-Verlag, 2000.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See pp. 132-133, 157-184.
  • József Sándor, Dragoslav S. Mitrinovic and Borislav Crstici, Handbook of Number Theory I, Springer Science & Business Media, 2005, Section VII.1. (For inequalities, etc.).
  • 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).
  • Gerald Tenenbaum and Michel Mendès France, Prime Numbers and Their Distribution, AMS Providence RI, 1999.
  • V. Udrescu, Some remarks concerning the conjecture pi(x + y) <= pi(x) + pi(y), Rev. Roumaine Math. Pures Appl. 20 (1975), 1201-1208.

Crossrefs

Closely related:
A099802: Number of primes <= 2n.
A060715: Number of primes between n and 2n (exclusive).
A035250: Number of primes between n and 2n (inclusive).
A038107: Number of primes < n^2.
A014085: Number of primes between n^2 and (n+1)^2.
A007053: Number of primes <= 2^n.
A036378: Number of primes p between powers of 2, 2^n < p <= 2^(n+1).
A006880: Number of primes < 10^n.
A006879: Number of primes with n digits.
A033270: Number of odd primes <= n.
A065855: Number of composites <= n.
For lists of large values of a(n) see, e.g., A005669(n) = a(A002386(n)), A214935(n) = a(A205827(n)).
Related sequences:
Primes (p) and composites (c): A000040, A002808, A065855.
Primes between p(n) and 2*p(n): A063124, A070046; between c(n) and 2*c(n): A376761; between n and 2*n: A035250, A060715, A077463, A108954.
Composites between p(n) and 2*p(n): A246514; between c(n) and 2*c(n): A376760; between n and 2*n: A075084, A307912, A307989, A376759.

Programs

  • Haskell
    a000720 n = a000720_list !! (n-1)
    a000720_list = scanl1 (+) a010051_list  -- Reinhard Zumkeller, Sep 15 2011
    
  • Magma
    [ #PrimesUpTo(n): n in [1..200] ];  // Bruno Berselli, Jul 06 2011
    
  • Maple
    with(numtheory); A000720 := pi; [ seq(A000720(i),i=1..50) ];
  • Mathematica
    A000720[n_] := PrimePi[n]; Table[ A000720[n], {n, 1, 100} ]
    Array[ PrimePi[ # ]&, 100 ]
    Accumulate[Table[Boole[PrimeQ[n]],{n,100}]] (* Harvey P. Dale, Jan 17 2015 *)
  • PARI
    A000720=vector(100,n,omega(n!)) \\ For illustration only; better use A000720=primepi
    
  • PARI
    vector(300,j,primepi(j)) \\ Joerg Arndt, May 09 2008
    
  • Python
    from sympy import primepi
    for n in range(1,100): print(primepi(n), end=', ') # Stefano Spezia, Nov 30 2018
  • Sage
    [prime_pi(n) for n in range(1, 79)]  # Zerinvary Lajos, Jun 06 2009
    

Formula

The prime number theorem gives the asymptotic expression a(n) ~ n/log(n).
For x > 1, pi(x) < (x / log x) * (1 + 3/(2 log x)). For x >= 59, pi(x) > (x / log x) * (1 + 1/(2 log x)). [Rosser and Schoenfeld]
For x >= 355991, pi(x) < (x / log(x)) * (1 + 1/log(x) + 2.51/(log(x))^2 ). For x >= 599, pi(x) > (x / log(x)) * (1 + 1/log(x)). [Dusart]
For x >= 55, x/(log(x) + 2) < pi(x) < x/(log(x) - 4). [Rosser]
For n > 1, A138194(n) <= a(n) <= A138195(n) (Tschebyscheff, 1850). - Reinhard Zumkeller, Mar 04 2008
For n >= 33, a(n) = 1 + Sum_{j=3..n} ((j-2)! - j*floor((j-2)!/j)) (Hardy and Wright); for n >= 1, a(n) = n - 1 + Sum_{j=2..n} (floor((2 - Sum_{i=1..j} (floor(j/i)-floor((j-1)/i)))/j)) (Ruiz and Sondow 2000). - Benoit Cloitre, Aug 31 2003
a(n) = A001221(A000142(n)). - Benoit Cloitre, Jun 03 2005
G.f.: Sum_{p prime} x^p/(1-x) = b(x)/(1-x), where b(x) is the g.f. for A010051. - Franklin T. Adams-Watters, Jun 15 2006
a(n) = A036234(n) - 1. - Jaroslav Krizek, Mar 23 2009
From Enrique Pérez Herrero, Jul 12 2010: (Start)
a(n) = Sum_{i=2..n} floor((i+1)/A000203(i)).
a(n) = Sum_{i=2..n} floor(A000010(n)/(i-1)).
a(n) = Sum_{i=2..n} floor(2/A000005(n)). (End)
Let pf(n) denote the set of prime factors of an integer n. Then a(n) = card(pf(n!/floor(n/2)!)). - Peter Luschny, Mar 13 2011
a(n) = -Sum_{p <= n} mu(p). - Wesley Ivan Hurt, Jan 04 2013
a(n) = (1/2)*Sum_{p <= n} (mu(p)*d(p)*sigma(p)*phi(p)) + sum_{p <= n} p^2. - Wesley Ivan Hurt, Jan 04 2013
a(1) = 0 and then, for all k >= 1, repeat k A001223(k) times. - Jean-Christophe Hervé, Oct 29 2013
a(n) = n/(log(n) - 1 - Sum_{k=1..m} A233824(k)/log(n)^k + O(1/log(n)^{m+1})) for m > 0. - Jonathan Sondow, Dec 19 2013
a(n) = A001221(A003418(n)). - Eric Desbiaux, May 01 2014
a(n) = Sum_{j=2..n} H(-sin^2 (Pi*(Gamma(j)+1)/j)) where H(x) is the Heaviside step function, taking H(0)=1. - Keshav Raghavan, Jun 18 2016
a(A014076(n)) = (1/2) * (A014076(n) + 1) - n + 1. - Christopher Heiling, Mar 03 2017
From Steven Foster Clark, Sep 25 2018: (Start)
a(n) = Sum_{m=1..n} A143519(m) * floor(n/m).
a(n) = Sum_{m=1..n} A001221(m) * A002321(floor(n/m)) where A002321() is the Mertens function.
a(n) = Sum_{m=1..n} |A143519(m)| * A002819(floor(n/m)) where A002819() is the Liouville Lambda summatory function and |x| is the absolute value of x.
a(n) = Sum_{m=1..n} A137851(m)/m * H(floor(n/m)) where H(n) = Sum_{m=1..n} 1/m is the harmonic number function.
a(n) = Sum_{m=1..log_2(n)} A008683(m) * A025528(floor(n^(1/m))) where A008683() is the Moebius mu function and A025528() is the prime-power counting function.
(End)
Sum_{k=2..n} 1/a(k) ~ (1/2) * log(n)^2 + O(log(n)) (de Koninck and Ivić, 1980). - Amiram Eldar, Mar 08 2021
a(n) ~ 1/(n^(1/n)-1). - Thomas Ordowski, Jan 30 2023
a(n) = Sum_{j=2..n} floor(((j - 1)! + 1)/j - floor((j - 1)!/j)) [Mináč, unpublished] (see Ribenboim, pp. 132-133). - Stefano Spezia, Apr 13 2025
a(n) = n - 1 - Sum_{k=2..floor(log_2(n))} pi_k(n), where pi_k(n) is the number of k-almost primes <= n. - Daniel Suteu, Aug 27 2025

Extensions

Additional links contributed by Lekraj Beedassy, Dec 23 2003
Edited by M. F. Hasler, Apr 27 2018 and (links recovered) Dec 21 2018

A003418 Least common multiple (or LCM) of {1, 2, ..., n} for n >= 1, a(0) = 1.

Original entry on oeis.org

1, 1, 2, 6, 12, 60, 60, 420, 840, 2520, 2520, 27720, 27720, 360360, 360360, 360360, 720720, 12252240, 12252240, 232792560, 232792560, 232792560, 232792560, 5354228880, 5354228880, 26771144400, 26771144400, 80313433200, 80313433200, 2329089562800, 2329089562800
Offset: 0

Views

Author

Roland Anderson (roland.anderson(AT)swipnet.se)

Keywords

Comments

The minimal exponent of the symmetric group S_n, i.e., the least positive integer for which x^a(n)=1 for all x in S_n. - Franz Vrabec, Dec 28 2008
Product over all primes of highest power of prime less than or equal to n. a(0) = 1 by convention.
Also smallest number whose set of divisors contains an n-term arithmetic progression. - Reinhard Zumkeller, Dec 09 2002
An assertion equivalent to the Riemann hypothesis is: | log(a(n)) - n | < sqrt(n) * log(n)^2. - Lekraj Beedassy, Aug 27 2006. (This is wrong for n = 1 and n = 2. Should "for n large enough" be added? - Georgi Guninski, Oct 22 2011)
Corollary 3 of Farhi gives a proof that a(n) >= 2^(n-1). - Jonathan Vos Post, Jun 15 2009
Appears to be row products of the triangle T(n,k) = b(A010766) where b = A130087/A130086. - Mats Granvik, Jul 08 2009
Greg Martin (see link) proved that "the product of the Gamma function sampled over the set of all rational numbers in the open interval (0,1) whose denominator in lowest terms is at most n" equals (2*Pi)^(1/2)*a(n)^(-1/2). - Jonathan Vos Post, Jul 28 2009
a(n) = lcm(A188666(n), A188666(n)+1, ..., n). - Reinhard Zumkeller, Apr 25 2011
a(n+1) is the smallest integer such that all polynomials a(n+1)*(1^i + 2^i + ... + m^i) in m, for i=0,1,...,n, are polynomials with integer coefficients. - Vladimir Shevelev, Dec 23 2011
It appears that A020500(n) = a(n)/a(n-1). - Asher Auel, corrected by Bill McEachen, Apr 05 2024
n-th distinct value = A051451(n). - Matthew Vandermast, Nov 27 2009
a(n+1) = least common multiple of n-th row in A213999. - Reinhard Zumkeller, Jul 03 2012
For n > 2, (n-1) = Sum_{k=2..n} exp(a(n)*2*i*Pi/k). - Eric Desbiaux, Sep 13 2012
First column minus second column of A027446. - Eric Desbiaux, Mar 29 2013
For n > 0, a(n) is the smallest number k such that n is the n-th divisor of k. - Michel Lagneau, Apr 24 2014
Slowest growing integer > 0 in Z converging to 0 in Z^ when considered as profinite integer. - Herbert Eberle, May 01 2016
What is the largest number of consecutive terms that are all equal? I found 112 equal terms from a(370261) to a(370372). - Dmitry Kamenetsky, May 05 2019
Answer: there exist arbitrarily long sequences of consecutive terms with the same value; also, the maximal run of consecutive terms with different values is 5 from a(1) to a(5) (see link Roger B. Eggleton). - Bernard Schott, Aug 07 2019
Related to the inequality (54) in Ramanujan's paper about highly composite numbers A002182, also used in A199337: a(A329570(m))^2 is a (not minimal) bound above which all highly composite numbers are divisible by m, according to the right part of that inequality. - M. F. Hasler, Jan 04 2020
For n > 2, a(n) is of the form 2^e_1 * p_2^e_2 * ... * p_m^e_m, where e_m = 1 and e = floor(log_2(p_m)) <= e_1. Therefore, 2^e * p_m^e_m is a primitive Zumkeler number (A180332). Therefore, 2^e_1 * p_m^e_m is a Zumkeller number (A083207). Therefore, for n > 2, a(n) = 2^e_1 * p_m^e_m * r, where r is relatively prime to 2*p_m, is a Zumkeller number (see my proof at A002182 for details). - Ivan N. Ianakiev, May 10 2020
For n > 1, 2|(a(n)+2) ... n|(a(n)+n), so a(n)+2 .. a(n)+n are all composite and (part of) a prime gap of at least n. (Compare n!+2 .. n!+n). - Stephen E. Witham, Oct 09 2021

Examples

			LCM of {1,2,3,4,5,6} = 60. The primes up to 6 are 2, 3 and 5. floor(log(6)/log(2)) = 2 so the exponent of 2 is 2.
floor(log(6)/log(3)) = 1 so the exponent of 3 is 1.
floor(log(6)/log(5)) = 1 so the exponent of 5 is 1. Therefore, a(6) = 2^2 * 3^1 * 5^1 = 60. - _David A. Corneth_, Jun 02 2017
		

References

  • J. M. Borwein and P. B. Borwein, Pi and the AGM, Wiley, 1987, p. 365.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row products of A133233.
Cf. A025528 (number of prime factors of a(n) with multiplicity).
Cf. A275120 (lengths of runs of consecutive equal terms), A276781 (ordinal transform from term a(1)=1 onward).

Programs

  • Haskell
    a003418 = foldl lcm 1 . enumFromTo 2
    -- Reinhard Zumkeller, Apr 04 2012, Apr 25 2011
    
  • Magma
    [1] cat [Exponent(SymmetricGroup(n)) : n in [1..28]]; // Arkadiusz Wesolowski, Sep 10 2013
    
  • Magma
    [Lcm([1..n]): n in [0..30]]; // Bruno Berselli, Feb 06 2015
    
  • Maple
    A003418 := n-> lcm(seq(i,i=1..n));
    HalfFarey := proc(n) local a,b,c,d,k,s; a := 0; b := 1; c := 1; d := n; s := NULL; do k := iquo(n + b, d); a, b, c, d := c, d, k*c - a, k*d - b; if 2*a > b then break fi; s := s,(a/b); od: [s] end: LCM := proc(n) local i; (1/2)*mul(2*sin(Pi*i),i=HalfFarey(n))^2 end: # Peter Luschny
    # next Maple program:
    a:= proc(n) option remember; `if`(n=0, 1, ilcm(n, a(n-1))) end:
    seq(a(n), n=0..33);  # Alois P. Heinz, Jun 10 2021
  • Mathematica
    Table[LCM @@ Range[n], {n, 1, 40}] (* Stefan Steinerberger, Apr 01 2006 *)
    FoldList[ LCM, 1, Range@ 28]
    A003418[0] := 1; A003418[1] := 1; A003418[n_] := A003418[n] = LCM[n,A003418[n-1]]; (* Enrique Pérez Herrero, Jan 08 2011 *)
    Table[Product[Prime[i]^Floor[Log[Prime[i], n]], {i, PrimePi[n]}], {n, 0, 28}] (* Wei Zhou, Jun 25 2011 *)
    Table[Product[Cyclotomic[n, 1], {n, 2, m}], {m, 0, 28}] (* Fred Daniel Kline, May 22 2014 *)
    a1[n_] := 1/12 (Pi^2+3(-1)^n (PolyGamma[1,1+n/2] - PolyGamma[1,(1+n)/2])) // Simplify
    a[n_] := Denominator[Sqrt[a1[n]]];
    Table[If[IntegerQ[a[n]], a[n], a[n]*(a[n])[[2]]], {n, 0, 28}] (* Gerry Martens, Apr 07 2018 [Corrected by Vaclav Kotesovec, Jul 16 2021] *)
  • PARI
    a(n)=local(t); t=n>=0; forprime(p=2,n,t*=p^(log(n)\log(p))); t
    
  • PARI
    a(n)=if(n<1,n==0,1/content(vector(n,k,1/k)))
    
  • PARI
    a(n)=my(v=primes(primepi(n)),k=sqrtint(n),L=log(n+.5));prod(i=1,#v,if(v[i]>k,v[i],v[i]^(L\log(v[i])))) \\ Charles R Greathouse IV, Dec 21 2011
    
  • PARI
    a(n)=lcm(vector(n,i,i)) \\ Bill Allombert, Apr 18 2012 [via Charles R Greathouse IV]
    
  • PARI
    n=1; lim=100; i=1; j=1; until(n==lim, a=lcm(j,i+1); i++; j=a; n++; print(n" "a);); \\ Mike Winkler, Sep 07 2013
    
  • Python
    from functools import reduce
    from operator import mul
    from sympy import sieve
    def integerlog(n,b): # find largest integer k>=0 such that b^k <= n
        kmin, kmax = 0,1
        while b**kmax <= n:
            kmax *= 2
        while True:
            kmid = (kmax+kmin)//2
            if b**kmid > n:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return kmin
    def A003418(n):
        return reduce(mul,(p**integerlog(n,p) for p in sieve.primerange(1,n+1)),1) # Chai Wah Wu, Mar 13 2021
    
  • Python
    # generates initial segment of sequence
    from math import gcd
    from itertools import accumulate
    def lcm(a, b): return a * b // gcd(a, b)
    def aupton(nn): return [1] + list(accumulate(range(1, nn+1), lcm))
    print(aupton(30)) # Michael S. Branicky, Jun 10 2021
  • Sage
    [lcm(range(1,n)) for n in range(1, 30)] # Zerinvary Lajos, Jun 06 2009
    
  • Scheme
    (define (A003418 n) (let loop ((n n) (m 1)) (if (zero? n) m (loop (- n 1) (lcm m n))))) ;; Antti Karttunen, Jan 03 2018
    

Formula

The prime number theorem implies that lcm(1,2,...,n) = exp(n(1+o(1))) as n -> infinity. In other words, log(lcm(1,2,...,n))/n -> 1 as n -> infinity. - Jonathan Sondow, Jan 17 2005
a(n) = Product (p^(floor(log n/log p))), where p runs through primes not exceeding n (i.e., primes 2 through A007917(n)). - Lekraj Beedassy, Jul 27 2004
Greg Martin showed that a(n) = lcm(1,2,3,...,n) = Product_{i = Farey(n), 0 < i < 1} 2*Pi/Gamma(i)^2. This can be rewritten (for n > 1) as a(n) = (1/2)*(Product_{i = Farey(n), 0 < i <= 1/2} 2*sin(i*Pi))^2. - Peter Luschny, Aug 08 2009
Recursive formula useful for computations: a(0)=1; a(1)=1; a(n)=lcm(n,a(n-1)). - Enrique Pérez Herrero, Jan 08 2011
From Enrique Pérez Herrero, Jun 01 2011: (Start)
a(n)/a(n-1) = A014963(n).
if n is a prime power p^k then a(n)=a(p^k)=p*a(n-1), otherwise a(n)=a(n-1).
a(n) = Product_{k=2..n} (1 + (A007947(k)-1)*floor(1/A001221(k))), for n > 1. (End)
a(n) = A079542(n+1, 2) for n > 1.
a(n) = exp(Sum_{k=1..n} Sum_{d|k} moebius(d)*log(k/d)). - Peter Luschny, Sep 01 2012
a(n) = A025529(n) - A027457(n). - Eric Desbiaux, Mar 14 2013
a(n) = exp(Psi(n)) = 2 * Product_{k=2..A002088(n)} (1 - exp(2*Pi*i * A038566(k+1) / A038567(k))), where i is the imaginary unit, and Psi the second Chebyshev's function. - Eric Desbiaux, Aug 13 2014
a(n) = A064446(n)*A038610(n). - Anthony Browne, Jun 16 2016
a(n) = A000142(n) / A025527(n) = A000793(n) * A225558(n). - Antti Karttunen, Jun 02 2017
log(a(n)) = Sum_{k>=1} (A309229(n, k)/k - 1/k). - Mats Granvik, Aug 10 2019
From Petros Hadjicostas, Jul 24 2020: (Start)
Nair (1982) proved that 2^n <= a(n) <= 4^n for n >= 9. See also Farhi (2009). Nair also proved that
a(n) = lcm(m*binomial(n,m): 1 <= m <= n) and
a(n) = gcd(a(m)*binomial(n,m): n/2 <= m <= n). (End)
Sum_{n>=1} 1/a(n) = A064859. - Bernard Schott, Aug 24 2020

A057820 First differences of sequence of consecutive prime powers (A000961).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, 4, 2, 2, 2, 2, 1, 5, 4, 2, 4, 2, 4, 6, 2, 3, 3, 4, 2, 6, 2, 2, 6, 8, 4, 2, 4, 2, 4, 8, 4, 2, 1, 3, 6, 2, 10, 2, 6, 6, 4, 2, 4, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 2, 8, 5, 1, 6, 6, 2, 6, 4, 2, 6, 4, 14, 4, 2, 4, 14, 6, 6, 4, 2, 4, 6, 2, 6, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10
Offset: 1

Views

Author

Labos Elemer, Nov 08 2000

Keywords

Comments

a(n) = 1 iff A000961(n) = A006549(k) for some k. - Reinhard Zumkeller, Aug 25 2002
Also run lengths of distinct terms in A070198. - Reinhard Zumkeller, Mar 01 2012
Does this sequence contain all positive integers? - Gus Wiseman, Oct 09 2024

Examples

			Odd differences arise in pairs in neighborhoods of powers of 2, like {..,2039,2048,2053,..} gives {..,11,5,..}
		

Crossrefs

For perfect-powers (A001597) we have A053289.
For non-perfect-powers (A007916) we have A375706.
Positions of ones are A375734.
Run-compression is A376308.
Run-lengths are A376309.
Sorted positions of first appearances are A376340.
The second (instead of first) differences are A376596, zeros A376597.
Prime-powers:
- terms: A000961 or A246655, complement A024619
- differences: A057820 (this), first appearances A376341
- anti-runs: A373576, A120430, A006549, A373671
Non-prime-powers:
- terms: A361102
- differences: A375708 (ones A375713)
- anti-runs: A373679, A373575, A255346, A373672

Programs

  • Haskell
    a057820_list = zipWith (-) (tail a000961_list) a000961_list
    -- Reinhard Zumkeller, Mar 01 2012
    
  • Maple
    A057820 := proc(n)
            A000961(n+1)-A000961(n) ;
    end proc: # R. J. Mathar, Sep 23 2016
  • Mathematica
    Map[Length, Split[Table[Apply[LCM, Range[n]], {n, 1, 150}]]] (* Geoffrey Critzer, May 29 2015 *)
    Join[{1},Differences[Select[Range[500],PrimePowerQ]]] (* Harvey P. Dale, Apr 21 2022 *)
  • PARI
    isA000961(n) = (omega(n) == 1 || n == 1)
    n_prev=1;for(n=2,500,if(isA000961(n),print(n-n_prev);n_prev=n)) \\ Michael B. Porter, Oct 30 2009
    
  • Python
    from sympy import primepi, integer_nthroot
    def A057820(n):
        def f(x): return int(n+x-1-sum(primepi(integer_nthroot(x,k)[0]) for k in range(1,x.bit_length())))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        r, k = m, f(m)+1
        while r != k: r, k = k, f(k)+1
        return r-m # Chai Wah Wu, Sep 12 2024

Formula

a(n) = A000961(n+1) - A000961(n).

Extensions

Offset corrected and b-file adjusted by Reinhard Zumkeller, Mar 03 2012

A022559 Sum of exponents in prime-power factorization of n!.

Original entry on oeis.org

0, 0, 1, 2, 4, 5, 7, 8, 11, 13, 15, 16, 19, 20, 22, 24, 28, 29, 32, 33, 36, 38, 40, 41, 45, 47, 49, 52, 55, 56, 59, 60, 65, 67, 69, 71, 75, 76, 78, 80, 84, 85, 88, 89, 92, 95, 97, 98, 103, 105, 108, 110, 113, 114, 118, 120, 124, 126, 128, 129, 133, 134, 136, 139
Offset: 0

Views

Author

Karen E. Wandel (kw29(AT)evansville.edu)

Keywords

Comments

Partial sums of Omega(n) (A001222). - N. J. A. Sloane, Feb 06 2022

Examples

			For n=5, 5! = 120 = 2^3*3^1*5^1 so a(5) = 3+1+1 = 5. - _N. J. A. Sloane_, May 26 2018
		

Crossrefs

Programs

  • Haskell
    a022559 n = a022559_list !! n
    a022559_list = scanl (+) 0 $ map a001222 [1..]
    -- Reinhard Zumkeller, Feb 16 2012
    
  • Maple
    with(numtheory):with(combinat):a:=proc(n) if n=0 then 0 else bigomega(numbperm(n)) fi end: seq(a(n), n=0..63); # Zerinvary Lajos, Apr 11 2008
    # Alternative:
    ListTools:-PartialSums(map(numtheory:-bigomega, [$0..200])); # Robert Israel, Dec 21 2018
  • Mathematica
    Array[Plus@@Last/@FactorInteger[ #! ] &, 5!, 0] (* Vladimir Joseph Stephan Orlovsky, Nov 10 2009 *)
    f[n_] := If[n <= 1, 0, Total[FactorInteger[n]][[2]]]; Accumulate[Array[f, 100, 0]] (* T. D. Noe, Apr 11 2011 *)
    Table[PrimeOmega[n!], {n, 0, 70}] (* Jean-François Alcover, Jun 08 2013 *)
    Join[{0}, Accumulate[PrimeOmega[Range[70]]]] (* Harvey P. Dale, Jul 23 2013 *)
  • PARI
    a(n)=bigomega(n!)
    
  • PARI
    first(n)={my(k=0); vector(n, i, k+=bigomega(i))}
    
  • PARI
    a(n) = sum(k=1, primepi(n), (n - sumdigits(n, prime(k))) / (prime(k)-1)); \\ Daniel Suteu, Apr 18 2018
    
  • PARI
    a(n) = my(res = 0); forprime(p = 2, n, cn = n; while(cn > 0, res += (cn \= p))); res \\ David A. Corneth, Apr 27 2018
    
  • Python
    from sympy import factorint as pf
    def aupton(nn):
        alst = [0]
        for n in range(1, nn+1): alst.append(alst[-1] + sum(pf(n).values()))
        return alst
    print(aupton(63)) # Michael S. Branicky, Aug 01 2021

Formula

a(n) = a(n-1) + A001222(n).
A027746(a(A000040(n))+1) = A000040(n). A082288(a(n)+1) = n.
A001221(n!) = omega(n!) = pi(n) = A000720(n).
a(n) = Sum_{i = 1..n} A001222(i). - Jonathan Vos Post, Feb 10 2010
a(n) = n log log n + B_2 * n + o(n), with B_2 = A083342. - Charles R Greathouse IV, Jan 11 2012
a(n) = A210241(n) - n for n > 0. - Reinhard Zumkeller, Mar 23 2012
G.f.: (1/(1 - x))*Sum_{p prime, k>=1} x^(p^k)/(1 - x^(p^k)). - Ilya Gutkovskiy, Mar 15 2017
a(n) = Sum_{k=1..floor(sqrt(n))} k * (A025528(floor(n/k)) - A025528(floor(n/(k+1)))) + Sum_{k=1..floor(n/(floor(sqrt(n))+1))} floor(n/k) * A069513(k). - Daniel Suteu, Dec 21 2018
a(n) = Sum_{prime p<=n} Sum_{k=1..floor(log_p(n))} floor(n/p^k). - Ridouane Oudra, Nov 04 2022
a(n) = Sum_{k=1..n} A069513(k)*floor(n/k). - Ridouane Oudra, Oct 04 2024

Extensions

Typo corrected by Daniel Forgues, Nov 16 2009

A246547 Prime powers p^e where p is a prime and e >= 2 (prime powers without the primes or 1).

Original entry on oeis.org

4, 8, 9, 16, 25, 27, 32, 49, 64, 81, 121, 125, 128, 169, 243, 256, 289, 343, 361, 512, 529, 625, 729, 841, 961, 1024, 1331, 1369, 1681, 1849, 2048, 2187, 2197, 2209, 2401, 2809, 3125, 3481, 3721, 4096, 4489, 4913, 5041, 5329, 6241, 6561, 6859, 6889, 7921, 8192, 9409, 10201, 10609, 11449, 11881, 12167, 12769, 14641
Offset: 1

Views

Author

Joerg Arndt, Aug 29 2014

Keywords

Comments

These are sometimes called the proper prime powers.
A proper subset of A001597.
Equals A000961 \ A008578 = { x in A001597 | A001221(x)=1 }. - M. F. Hasler, Aug 29 2014

Crossrefs

Essentially the same as A025475.
There are four different sequences which may legitimately be called "prime powers": A000961 (p^k, k >= 0), A246655 (p^k, k >= 1), A246547 (p^k, k >= 2), A025475 (p^k, k=0 and k >= 2). When you refer to "prime powers", be sure to specify which of these you mean. Also A001597 is the sequence of nontrivial powers n^k, n >= 1, k >= 2. - N. J. A. Sloane, Mar 24 2018

Programs

  • Maple
    isA246547 := proc(n)
        local ifs;
        ifs := ifactors(n)[2] ;
        if nops(ifs) <> 1 then
            false;
        else
            is(op(2, op(1, ifs)) > 1);
        end if;
    end proc:
    for n from 2 do
        if isA246547(n) then
            print(n) ;
        end if;
    end do: # R. J. Mathar, Feb 01 2016 # Or:
    isA246547 := n -> not isprime(n) and nops(numtheory:-factorset(n)) = 1:
    select(isA246547, [$1..10000]); # Peter Luschny, May 01 2018
  • Mathematica
    With[{upto=15000},Complement[Select[Range[upto],PrimePowerQ],Prime[ Range[ PrimePi[ upto]]]]] (* Harvey P. Dale, Nov 28 2014 *)
    Select[ Range@ 15000, PrimePowerQ@# && !SquareFreeQ@# &] (* Robert G. Wilson v, Dec 01 2014 *)
    With[{n = 15000}, Union@ Flatten@ Table[Array[p^# &, Floor@ Log[p, n] - 1, 2], {p, Prime@ Range@ PrimePi@ Sqrt@ n}] ] (* Michael De Vlieger, Jul 06 2018, faster program *)
  • PARI
    for(n=1,10^5,if(isprimepower(n)>=2,print1(n,", ")));
    
  • PARI
    m=10^5; v=[]; forprime(p=2, sqrtint(m), e=2; while(p^e<=m, v=concat(v, p^e); e++)); v=vecsort(v) \\ Faster program. Jens Kruse Andersen, Aug 29 2014
    
  • Python
    from sympy import primepi, integer_nthroot
    def A246547(n):
        def f(x): return int(n-1+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
        kmin, kmax = 1,2
        while f(kmax) >= kmax:
            kmax <<= 1
        while True:
            kmid = kmax+kmin>>1
            if f(kmid) < kmid:
                kmax = kmid
            else:
                kmin = kmid
            if kmax-kmin <= 1:
                break
        return kmax # Chai Wah Wu, Aug 14 2024
  • SageMath
    def A246547List(n):
        return [p for p in srange(2, n) if p.is_prime_power() and not p.is_prime()]
    print(A246547List(14642))  # Peter Luschny, Sep 16 2023
    

Formula

a(n) = A025475(n+1). - M. F. Hasler, Aug 29 2014
Sum_{n>=1} 1/a(n) = Sum_{p prime} 1/(p*(p-1)) = A136141. - Amiram Eldar, Dec 21 2020

A069513 Characteristic function of the prime powers p^k, k >= 1.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Apr 15 2002

Keywords

Comments

Also, number of Galois fields of order n. - Charles R Greathouse IV, Mar 12 2008
Also, number of abelian indecomposable groups of order n. - Kevin Lamoreau, Mar 13 2023

Crossrefs

The partial sums of this sequence give A025528. - Daniel Forgues, Mar 02 2009

Programs

Formula

If n >= 2, a(n) = A010055(n).
a(n) = Sum_{d|n} bigomega(d)*mu(n/d); equivalently, Sum_{d|n} a(d) = bigomega(n); equivalently, Möbius transform of bigomega(n).
Dirichlet g.f.: ppzeta(s). Here ppzeta(s) = Sum_{p prime} Sum_{k>=1} 1/(p^k)^s. Note that ppzeta(s) = Sum_{p prime} 1/(p^s - 1) = Sum_{k>=1} primezeta(k*s). - Franklin T. Adams-Watters, Sep 11 2005
a(n) = floor(1/A001221(n)), for n > 1. - Enrique Pérez Herrero, Jun 01 2011
a(n) = - Sum_{d|n} mu(d)*bigomega(d), where bigomega = A001222. - Ridouane Oudra, Oct 29 2024
a(n) = - Sum_{d|n} mu(d)*omega(d), where omega = A001221. - Ridouane Oudra, Jul 30 2025

Extensions

Moved original definition to formula line. Used comment (that I previously added) as definition. - Daniel Forgues, Mar 08 2009
Edited by Franklin T. Adams-Watters, Nov 02 2009

A065515 Number of prime powers <= n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Nov 27 2001

Keywords

Comments

a(n) > pi(n) = A000720(n).
From Chayim Lowen, Aug 05 2015: (Start)
a(n) <= pi(n) + A069623(n).
Conjecture: a(n) >= pi(A069623(n)) + pi(n) + 1.
Each term m is repeated A057820(m) times. (End)

Examples

			There are 9 prime powers <= 12: 1=2^0, 2, 3, 4=2^2, 5, 7, 8=2^3, 9=3^2 and 11, so a(12) = 9.
		

References

  • F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Elsevier-North Holland, 1978, Chapter 4.

Crossrefs

Cf. A000040, A000961, A000720, A276781 (ordinal transform).
A025528(n) = a(n) - 1.
Cf. A139555. - Reinhard Zumkeller, Oct 27 2010

Programs

  • Haskell
    a065515 n = length $ takeWhile (<= n) a000961_list
    -- Reinhard Zumkeller, Apr 25 2011
    
  • Maple
    N:= 100: # to get a(1) to a(N)
    L:= Vector(N):
    L[1]:= 1:
    p:= 1:
    while p < N do
      p:= nextprime(p);
      for k from 1 to floor(log[p](N)) do
        L[p^k] := 1;
      od
    od:
    ListTools:-PartialSums(convert(L,list)); # Robert Israel, May 03 2015
  • Mathematica
    a[n_] := 1 + Count[ Range[2, n], p_ /; Length[ FactorInteger[p]] == 1]; Table[a[n], {n, 1, 73}] (* Jean-François Alcover, Oct 12 2011 *)
    Accumulate[Table[If[Length[FactorInteger[n]]==1,1,0],{n,80}]] (* Harvey P. Dale, Aug 06 2016 *)
    Accumulate[Table[If[PrimePowerQ[n],1,0],{n,120}]]+1 (* Harvey P. Dale, Sep 29 2016 *)
  • PARI
    a(n)=n+=.5;1+sum(k=1,log(n)\log(2),primepi(n^(1/k))) \\ Charles R Greathouse IV, Apr 26 2012
    
  • Python
    from sympy import primepi
    from sympy.ntheory.primetest import integer_nthroot
    def A065515(n): return 1+sum(primepi(integer_nthroot(n,k)[0]) for k in range(1,n.bit_length())) # Chai Wah Wu, Jul 23 2024

Formula

Partial sums of A010055. - Reinhard Zumkeller, Nov 22 2009
a(n) = 1 + Sum_{k=1..log_2(n)} pi(floor(n^(1/k))). - Chayim Lowen, Aug 05 2015
a(n) = 1 + Sum_{k=2..n} floor(2*A001222(k)/(tau(k^2)-1)) where tau is A000005(n). - Anthony Browne, May 17 2016

A276781 a(n) = 1+n-(nearest power of prime <= n); for n > 1, a(n) = minimal b such that the numbers binomial(n,k) for b <= k <= n-b have a common divisor greater than 1.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 29 2016, following a suggestion from Eric Desbiaux

Keywords

Comments

The definition in the video has "b < k < n-b" rather than "b <= k <= n-b", but that appears to be a typographical error.
From Antti Karttunen, Jan 21 2020: (Start)
a(n) = 1 if n is a power of prime (term of A000961), otherwise a(n) is one more than the distance to the nearest preceding prime power.
For n > 1, a(n) indicates the maximum region on the row n of Pascal's triangle (A007318) such that binomial terms C(n,a(n)) .. C(n,n-a(n)) all share a common prime factor. Because for all prime powers, p^k, the binomial terms C(p^k,1) .. C(p^k,p^k-1) have p as their prime factor, we have a(A000961(n)) = 1 for all n, while for each successive n that is not a prime power, the region of shared prime factor shrinks one step more towards the center of the triangle. From this follows that this is the ordinal transform of A025528 (equally, of A065515, or of A003418(n) from n >= 1 onward), equivalent to the simple definition given above.
(End)

Examples

			Row 6 of Pascal's triangle is 1,6,15,20,15,6,1 and [15,20,15] have a common divisor of 5. Since 15 = binomial(6,2), a(6)=2.
		

Crossrefs

Cf. A007318, A010055, A276782 (positions of records), A000961 (positions of ones), A024619 (positions of terms > 1).

Programs

  • Maple
    mygcd:=proc(lis) local i,g,m;
    m:=nops(lis); g:=lis[1];
    for i from 2 to m do g:=gcd(g,lis[i]); od:
    g; end;
    f:=proc(n) local b,lis; global mygcd;
    for b from floor(n/2) by -1 to 1 do
    lis:=[seq(binomial(n,i),i=b..n-b)];
    if mygcd(lis)=1 then break; fi; od:
    b+1;
    end;
    [seq(f(n),n=2..120)];
  • Mathematica
    Table[b = 1; While[GCD @@ Map[Binomial[n, #] &, Range[b, n - b]] == 1, b++]; b, {n, 92}] (* Michael De Vlieger, Oct 03 2016 *)
  • PARI
    A276781(n) = if(1==n,1,forstep(k=n,1,-1,if(isprimepower(k),return(1+n-k)))); \\ Antti Karttunen, Jan 21 2020
    
  • Python
    from sympy import factorint
    def A276781(n): return 1+n-next(filter(lambda m:len(factorint(m))<=1, range(n,0,-1))) # Chai Wah Wu, Oct 25 2024

Formula

If A010055(n) == 1, a(n) = 1, otherwise a(n) = 1 + a(n-1). - Antti Karttunen, Jan 21 2020

Extensions

Term a(1) = 1 prepended and alternative simpler definition added to the name by Antti Karttunen, Jan 20 2020

A373671 Length of the n-th maximal antirun of prime-powers.

Original entry on oeis.org

1, 1, 1, 2, 1, 4, 7, 26, 27, 1007, 5558, 5734, 31209
Offset: 1

Views

Author

Gus Wiseman, Jun 14 2024

Keywords

Comments

An antirun of a sequence (in this case A000961 without 1) is an interval of positions at which consecutive terms differ by more than one.

Examples

			The maximal antiruns of prime-powers begin:
   2
   3
   4
   5   7
   8
   9  11  13  16
  17  19  23  25  27  29  31
		

Crossrefs

For prime antiruns we have A027833.
For nonsquarefree runs we have A053797, firsts A373199.
For non-prime-powers runs we have A110969, firsts A373669, sorted A373670.
For squarefree runs we have A120992.
For prime-power runs we have A174965.
For prime runs we have A175632.
For composite runs we have A176246, firsts A073051, sorted A373400.
For squarefree antiruns we have A373127, firsts A373128.
For composite antiruns we have A373403.
For antiruns of prime-powers:
- length A373671 (this sequence)
- min A120430
- max A006549
For antiruns of non-prime-powers:
- length A373672
- min A373575
- max A255346
A000961 lists the powers of primes (including 1).
A025528 counts prime-powers up to n.
A057820 gives first differences of consecutive prime-powers, gaps A093555.
A361102 lists the non-prime-powers (not including 1 A024619).

Programs

  • Mathematica
    Length/@Split[Select[Range[100],PrimePowerQ[#]&],#1+1!=#2&]//Most

Formula

Partial sums are A025528(A006549(n)).
Showing 1-10 of 42 results. Next