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

A020639 Lpf(n): least prime dividing n (when n > 1); a(1) = 1. Or, smallest prime factor of n, or smallest prime divisor of n.

Original entry on oeis.org

1, 2, 3, 2, 5, 2, 7, 2, 3, 2, 11, 2, 13, 2, 3, 2, 17, 2, 19, 2, 3, 2, 23, 2, 5, 2, 3, 2, 29, 2, 31, 2, 3, 2, 5, 2, 37, 2, 3, 2, 41, 2, 43, 2, 3, 2, 47, 2, 7, 2, 3, 2, 53, 2, 5, 2, 3, 2, 59, 2, 61, 2, 3, 2, 5, 2, 67, 2, 3, 2, 71, 2, 73, 2, 3, 2, 7, 2, 79, 2, 3, 2, 83, 2, 5, 2, 3, 2, 89, 2, 7, 2, 3, 2, 5, 2, 97
Offset: 1

Views

Author

Keywords

Comments

Also, the largest number of distinct integers such that all their pairwise differences are coprime to n. - Max Alekseyev, Mar 17 2006
The unit 1 is not a prime number (although it has been considered so in the past). 1 is the empty product of prime numbers, thus 1 has no least prime factor. - Daniel Forgues, Jul 05 2011
a(n) = least m > 0 for which n! + m and n - m are not relatively prime. - Clark Kimberling, Jul 21 2012
For n > 1, a(n) = the smallest k > 1 that divides n. - Antti Karttunen, Feb 01 2014
For n > 1, records are at prime indices. - Zak Seidov, Apr 29 2015
The initials "lpf" might be mistaken for "largest prime factor" (A009190), using "spf" for "smallest prime factor" would avoid this. - M. F. Hasler, Jul 29 2015
n = 89 is the first index > 1 for which a(n) differs from the smallest k > 1 such that (2^k + n - 2)/k is an integer. - M. F. Hasler, Aug 11 2015
From Stanislav Sykora, Jul 29 2017: (Start)
For n > 1, a(n) is also the smallest k, 1 < k <= n, for which the binomial(n,k) is not divisible by n.
Proof: (A) When k and n are relatively prime then binomial(n,k) is divisible by n because k*binomial(n,k) = n*binomial(n-1,k-1). (B) When gcd(n,k) > 1, one of its prime factors is the smallest; let us denote it p, p <= k, and consider the binomial(n,p) = (1/p!)*Product_{i=0..p-1} (n-i). Since p is a divisor of n, it cannot be a divisor of any of the remaining numerator factors. It follows that, denoting as e the largest e > 0 such that p^e|n, the numerator is divisible by p^e but not by p^(e+1). Hence, the binomial is divisible by p^(e-1) but not by p^e and therefore not divisible by n. Applying (A), (B) to all considered values of k completes the proof. (End)
From Bob Selcoe, Oct 11 2017, edited by M. F. Hasler, Nov 06 2017: (Start)
a(n) = prime(j) when n == J (mod A002110(j)), n, j >= 1, where J is the set of numbers <= A002110(j) with smallest prime factor = prime(j). The number of terms in J is A005867(j-1). So:
a(n) = 2 when n == 0 (mod 2);
a(n) = 3 when n == 3 (mod 6);
a(n) = 5 when n == 5 or 25 (mod 30);
a(n) = 7 when n == 7, 49, 77, 91, 119, 133, 161 or 203 (mod 210);
etc. (End)
For n > 1, a(n) is the leftmost term, other than 0 or 1, in the n-th row of A127093. - Davis Smith, Mar 05 2019

References

  • D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, Section IV.1.

Crossrefs

Cf. A090368 (bisection).
Cf. A046669 (partial sums), A072486 (partial products).
Cf. A127093.

Programs

  • Haskell
    a020639 n = spf a000040_list where
      spf (p:ps) | n < p^2      = n
                 | mod n p == 0 = p
                 | otherwise    = spf ps
    -- Reinhard Zumkeller, Jul 13 2011
    
  • Maple
    A020639 := proc(n) if n = 1 then 1; else min(op(numtheory[factorset](n))) ; end if; end proc: seq(A020639(n),n=1..20) ; # R. J. Mathar, Oct 25 2010
  • Mathematica
    f[n_]:=FactorInteger[n][[1,1]]; Join[{1}, Array[f,120,2]]  (* Robert G. Wilson v, Apr 06 2011 *)
    Join[{1}, Table[If[EvenQ[n], 2, FactorInteger[n][[1,1]]], {n, 2, 120}]] (* Zak Seidov, Nov 17 2013 *)
    Riffle[Join[{1},Table[FactorInteger[n][[1,1]],{n,3,101,2}]],2] (* Harvey P. Dale, Dec 16 2021 *)
  • PARI
    A020639(n) = { vecmin(factor(n)[,1]) } \\ [Will yield an error for n = 1.] - R. J. Mathar, Mar 02 2012
    
  • PARI
    A020639(n)=if(n>1, if(n>n=factor(n,0)[1,1], n, factor(n)[1,1]), 1) \\ Avoids complete factorization if possible. Often the smallest prime factor can be found quickly even if it is larger than primelimit. If factoring takes too long for large n, use debugging level >= 3 (\g3) to display the smallest factor as soon as it is found. - M. F. Hasler, Jul 29 2015
    
  • Python
    from sympy import factorint
    def a(n): return 1 if n == 1 else min(factorint(n))
    print([a(n) for n in range(1, 98)]) # Michael S. Branicky, Dec 09 2021
  • Sage
    def A020639_list(n) : return [1] + [prime_divisors(n)[0] for n in (2..n)]
    A020639_list(97) # Peter Luschny, Jul 16 2012
    
  • Sage
    [trial_division(n) for n in (1..100)] # Giuseppe Coppoletta, May 25 2016
    
  • Scheme
    (define (A020639 n) (if (< n 2) n (let loop ((k 2)) (cond ((zero? (modulo n k)) k) (else (loop (+ 1 k))))))) ;; Antti Karttunen, Feb 01 2014
    

Formula

A014673(n) = a(A032742(n)); A115561(n) = a(A054576(n)). - Reinhard Zumkeller, Mar 10 2006
A028233(n) = a(n)^A067029(n). - Reinhard Zumkeller, May 13 2006
a(n) = A027746(n,1) = A027748(n,1). - Reinhard Zumkeller, Aug 27 2011
For n > 1: a(n) = A240694(n,2). - Reinhard Zumkeller, Apr 10 2014
a(n) = A000040(A055396(n)) = n / A032742(n). - Antti Karttunen, Mar 07 2017
a(n) has average order n/(2 log n) [Brouwer] - N. J. A. Sloane, Sep 03 2017

Extensions

Deleted wrong comment from M. Lagneau in 2012, following an observation by Gionata Neri. - M. F. Hasler, Aug 11 2015
Edited by M. F. Hasler, Nov 06 2017
Expanded definition to make this easier to find. - N. J. A. Sloane, Sep 21 2020

A046670 Partial sums of A006530.

Original entry on oeis.org

1, 3, 6, 8, 13, 16, 23, 25, 28, 33, 44, 47, 60, 67, 72, 74, 91, 94, 113, 118, 125, 136, 159, 162, 167, 180, 183, 190, 219, 224, 255, 257, 268, 285, 292, 295, 332, 351, 364, 369, 410, 417, 460, 471, 476, 499, 546, 549, 556, 561, 578, 591, 644, 647, 658, 665, 684
Offset: 1

Views

Author

Keywords

References

  • Handbook of Number Theory, D. S. Mitrinovic et al., Kluwer, Section IV.1.

Crossrefs

Programs

  • Haskell
    a046670 n = a046670_list !! (n-1)
    a046670_list = scanl1 (+) a006530_list -- Reinhard Zumkeller, Jun 15 2013
    
  • Mathematica
    Accumulate[Prepend[Table[FactorInteger[n][[-1,1]],{n,2,100}],1]] (* Harvey P. Dale, Jun 11 2011 *)
  • PARI
    gpf(n)=if(n<4,n,n=factor(n)[,1];n[#n])
    a(n)=sum(k=1,n,gpf(k)) \\ Charles R Greathouse IV, Feb 19 2014

Formula

a(n) = Pi^2/12 * n^2/log n + O(n^2/log^2 n). [See Mitrinovic et al.] - Charles R Greathouse IV, Feb 19 2014

Extensions

More terms from James Sellers

A088821 a(n) is the sum of smallest prime factors of numbers from 1 to n.

Original entry on oeis.org

0, 2, 5, 7, 12, 14, 21, 23, 26, 28, 39, 41, 54, 56, 59, 61, 78, 80, 99, 101, 104, 106, 129, 131, 136, 138, 141, 143, 172, 174, 205, 207, 210, 212, 217, 219, 256, 258, 261, 263, 304, 306, 349, 351, 354, 356, 403, 405, 412, 414, 417, 419, 472, 474, 479, 481, 484
Offset: 1

Views

Author

Labos Elemer, Oct 22 2003

Keywords

References

  • M. Kalecki, On certain sums extended over primes or prime factors, Prace Mat, Vol. 8 (1963), pp. 121-127.
  • J. Sandor, D. S. Mitrinovic, B. Crstici, Handbook of Number Theory I, Volume 1, Springer, 2005, Chapter IV, p. 121.

Crossrefs

Programs

  • GAP
    P:=List(List([2..60],n->Factors(n)),i->i[1]);;
    a:=Concatenation([0],List([1..Length(P)],i->Sum([1..i],k->P[k]))); # Muniru A Asiru, Nov 29 2018
  • Mathematica
    Prepend[Accumulate[Rest[Table[FactorInteger[i][[1,1]],{i,60}]]],0] (* Harvey P. Dale, Jan 09 2011 *)
  • PARI
    a(n) = sum(k=2, n, factor(k)[1,1]); \\ Michel Marcus, May 15 2017
    

Formula

a(n) ~ n^2/(2 log n) [Kalecki]. - Thomas Ordowski, Nov 29 2018
a(n) = Sum_{prime p} n(p)*p, where n(p) is the number of integers in [1,n] with smallest prime factor spf(.) = A020639(.) = p, decreasing from n(2) = floor(n/2) to n(p) = 1 for p >= sqrt(n), possibly earlier, and n(p) = 0 for p > n. One has n(p) ~ D(p)*n where D(p) = (Product_{primes q < p} 1-1/q)/p = A038110/A038111 is the density of numbers having p as smallest prime factor. - M. F. Hasler, Dec 05 2018

A280050 a(n) = Sum_{k=2..n} k/lpf(k), where lpf(k) is the least prime dividing k (A020639).

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 13, 16, 21, 22, 28, 29, 36, 41, 49, 50, 59, 60, 70, 77, 88, 89, 101, 106, 119, 128, 142, 143, 158, 159, 175, 186, 203, 210, 228, 229, 248, 261, 281, 282, 303, 304, 326, 341, 364, 365, 389, 396, 421, 438, 464, 465, 492, 503, 531, 550, 579, 580, 610, 611, 642, 663, 695, 708, 741, 742, 776, 799, 834, 835
Offset: 1

Views

Author

Ilya Gutkovskiy, Jan 02 2017

Keywords

Comments

Sum of the largest proper divisors of all positive integers <= n.

Examples

			For n = 8 the divisors of the first eight positive integers are {1}, {1, 2}, {1, 3}, {1, 2, 4}, {1, 5}, {1, 2, 3, 6}, {1, 7}, {1, 2, 4, 8}, so a(8) = 1 + 1 + 2 + 1 + 3 + 1 + 4 = 13.
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[k/FactorInteger[k][[1, 1]], {k, 2, n}], {n, 71}]
    Join[{0}, Accumulate[Table[k/FactorInteger[k][[1, 1]], {k, 2, 71}]]] (* Amiram Eldar, Jul 03 2025 *)
  • PARI
    list(kmax) = {my(s = 0); print1(s, ", "); for(k = 2, kmax, s += k/factor(k)[1,1]; print1(s, ", "));} \\ Amiram Eldar, Jul 03 2025

Formula

a(n) = Sum_{k=2..n} k/A020639(k).
a(n) + 1 = Sum_{k=1..n} A032742(k).
a(p^k) = a(p^k-1) + p^(k-1), when p is prime.
a(n) ~ c * n^2, where c = (1/2) * Sum_{k>=1} A005867(k-1)/(prime(k)*A002110(k)) = 0.165049... . - Amiram Eldar, Jul 03 2025
Showing 1-4 of 4 results.