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.

A078898 Number of times the smallest prime factor of n is the smallest prime factor for numbers <= n; a(0)=0, a(1)=1.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 12 2002

Keywords

Comments

From Antti Karttunen, Dec 06 2014: (Start)
For n >= 2, a(n) tells in which column of the sieve of Eratosthenes (see A083140, A083221) n occurs in. A055396 gives the corresponding row index.
(End)

Crossrefs

Programs

  • Haskell
    import Data.IntMap (empty, findWithDefault, insert)
    a078898 n = a078898_list !! n
    a078898_list = 0 : 1 : f empty 2 where
       f m x = y : f (insert p y m) (x + 1) where
               y = findWithDefault 0 p m + 1
               p = a020639 x
    -- Reinhard Zumkeller, Apr 06 2015
  • Maple
    N:= 1000: # to get a(0) to a(N)
    Primes:= select(isprime, [2,seq(2*i+1,i=1..floor((N-1)/2))]):
    A:= Vector(N):
    for p in Primes do
      t:= 1:
      A[p]:= 1:
      for n from p^2 to N by p do
        if A[n] = 0 then
           t:= t+1:
           A[n]:= t
        fi
      od
    od:
    0,1,seq(A[i],i=2..N); # Robert Israel, Jan 04 2015
  • Mathematica
    Module[{nn=90,spfs},spfs=Table[FactorInteger[n][[1,1]],{n,nn}];Table[ Count[ Take[spfs,i],spfs[[i]]],{i,nn}]] (* Harvey P. Dale, Sep 01 2014 *)
  • PARI
    \\ Not practical for computing, but demonstrates the sum moebius formula:
    A020639(n) = { if(1==n,n,vecmin(factor(n)[, 1])); };
    A055396(n) = { if(1==n,0,primepi(A020639(n))); };
    A002110(n) = prod(i=1, n, prime(i));
    A078898(n) = { my(k,p); if(1==n, n, k = A002110(A055396(n)-1); p = A020639(n); sumdiv(k, d, moebius(d)*(n\(p*d)))); };
    \\ Antti Karttunen, Dec 05 2014
    
  • Scheme
    ;; With memoizing definec-macro.
    (definec (A078898 n) (if (< n 2) n (+ 1 (A078898 (A249744 n)))))
    ;; Much better for computing. Needs also code from A249738 and A249744. - Antti Karttunen, Dec 06 2014
    

Formula

Ordinal transform of A020639 (Lpf). - Franklin T. Adams-Watters, Aug 28 2006
From Antti Karttunen, Dec 05-08 2014: (Start)
a(0) = 0, a(1) = 1, a(n) = 1 + a(A249744(n)).
a(0) = 0, a(1) = 1, a(n) = sum_{d | A002110(A055396(n)-1)} moebius(d) * floor(n / (A020639(n)*d)).
a(0) = 0, a(1) = 1, a(n) = sum_{d | A002110(A055396(n)-1)} moebius(d) * floor(A032742(n) / d).
[Instead of Moebius mu (A008683) one could use Liouville's lambda (A008836) in the above formulas, because all primorials (A002110) are squarefree. A020639(n) gives the smallest prime dividing n, and A055396 gives its index].
a(0) = 0, a(1) = 1, a(2n) = n, a(2n+1) = a(A250470(2n+1)). [After a similar recursive formula for A246277. However, this cannot be used for computing the sequence, unless a definition for A250470(n) is found which doesn't require computing the value of A078898(n).]
For n > 1: a(n) = A249810(n) - A249820(n).
(End)
Other identities:
a(2*n) = n.
For n > 1: a(n)=1 if and only if n is prime.
For n > 1: a(n) = A249808(n, A055396(n)) = A249809(n, A055396(n)).
For n > 1: a(n) = A246277(A249818(n)).
From Antti Karttunen, Jan 04 2015: (Start)
a(n) = 2 if and only if n is a square of a prime.
For all n >= 1: a(A251728(n)) = A243055(A251728(n)) + 2. That is, if n is a semiprime of the form prime(i)*prime(j), prime(i) <= prime(j) < prime(i)^2, then a(n) = (j-i)+2.
(End)
a(A000040(n)^2) = 2; a(A000040(n)*A000040(n+1)) = 3. - Reinhard Zumkeller, Apr 06 2015
Sum_{k=1..n} a(k) ~ c * n^2 / 2, where c = Sum_{k>=1} (A038110(k)/A038111(k))^2 = 0.2847976823663... . - Amiram Eldar, Oct 26 2024

Extensions

a(0) = 0 prepended for recurrence's sake by Antti Karttunen, Dec 06 2014

A250474 Number of times prime(n) occurs as the least prime factor among numbers 1 .. prime(n)^3: a(n) = A078898(A030078(n)).

Original entry on oeis.org

4, 5, 9, 14, 28, 36, 57, 67, 93, 139, 154, 210, 253, 272, 317, 396, 473, 504, 593, 658, 687, 792, 866, 979, 1141, 1229, 1270, 1356, 1397, 1496, 1849, 1947, 2111, 2159, 2457, 2514, 2695, 2880, 3007, 3204, 3398, 3473, 3828, 3904, 4047, 4121, 4583, 5061, 5228, 5309, 5474, 5743, 5832, 6269, 6543, 6816, 7107, 7197, 7488, 7686, 7784, 8295, 9029, 9248, 9354, 9568, 10351
Offset: 1

Views

Author

Antti Karttunen, Nov 23 2014

Keywords

Comments

Position of the first composite number (which is always 4) on row n of A249821. The fourth column of A249822.
Position of the first nonfixed term on row n of arrays of permutations A251721 and A251722.
According to the definition, this is the number of multiples of prime(n) below prime(n)^3 (and thus, the number of numbers below prime(n)^2) which do not have a smaller factor than prime(n). That is, the numbers remaining below prime(n)^2 after deleting all multiples of primes less than prime(n), as is done by applying the first n-1 steps of the sieve of Eratosthenes (when the first step is elimination of multiples of 2). This explains that the first differences are a(n+1)-a(n) = A050216(n)-1 for n>1, and a(n) = A054272(n)+2. - M. F. Hasler, Dec 31 2014

Examples

			prime(1) = 2 occurs as the least prime factor in range [1,8] for four times (all even numbers <= 8), thus a(1) = 4.
prime(2) = 3 occurs as the least prime factor in range [1,27] for five times (when n is: 3, 9, 15, 21, 27), thus a(2) = 5.
		

Crossrefs

One more than A250473. Two more than A054272.
Column 4 of A249822.
Cf. also A250477 (column 6), A250478 (column 8).

Programs

  • Mathematica
    f[n_] := Count[Range[Prime[n]^3], x_ /; Min[First /@ FactorInteger[x]] == Prime@ n]; Array[f, 16] (* Michael De Vlieger, Mar 30 2015 *)
  • PARI
    A250474(n) = 3 + primepi(prime(n)^2) - n; \\ Fast implementation.
    for(n=1, 5001, write("b250474.txt", n, " ", A250474(n)));
    \\ The following program reflects the given sum formula, but is far from the optimal solution:
    allocatemem(234567890);
    A002110(n) = prod(i=1, n, prime(i));
    A020639(n) = if(1==n,n,vecmin(factor(n)[,1]));
    A055396(n) = if(1==n,0,primepi(A020639(n)));
    A250474(n) = { my(p2 = prime(n)^2); sumdiv(A002110(n-1), d, moebius(d)*(p2\d)); };
    for(n=1, 23, print1(A250474(n),", "));
    
  • Scheme
    (define (A250474 n) (let loop ((k 2)) (if (not (prime? (A249821bi n k))) k (loop (+ k 1))))) ;; This is even slower. Code for A249821bi given in A249821.

Formula

a(n) = 3 + A000879(n) - n = A054272(n) + 2 = A250473(n) + 1.
a(n) = A078898(A030078(n)).
a(1) = 1, a(n) = Sum_{d|A002110(n-1)} moebius(d)*floor(prime(n)^2/d). [Follows when A030078(n), prime(n)^3 is substituted to the similar formula given for A078898(n). Here A002110(n) gives the product of the first n primes. Because the latter is always squarefree, one could use also Liouville's lambda (A008836) instead of Moebius mu (A008683)].
Other identities. For all n >= 1:
A249821(n, a(n)) = 4.

A249822 Square array of permutations: A(row,col) = A078898(A246278(row,col)), read by antidiagonals A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 3, 2, 1, 5, 5, 3, 2, 1, 6, 4, 9, 3, 2, 1, 7, 8, 4, 14, 3, 2, 1, 8, 6, 12, 4, 28, 3, 2, 1, 9, 14, 5, 21, 4, 36, 3, 2, 1, 10, 13, 42, 5, 33, 4, 57, 3, 2, 1, 11, 11, 17, 92, 5, 45, 4, 67, 3, 2, 1, 12, 7, 19, 33, 305, 5, 63, 4, 93, 3, 2, 1, 13, 23, 6, 25, 39, 455, 5, 80, 4, 139, 3, 2, 1, 14, 9, 59, 6, 43, 61, 944, 5, 116, 4, 154, 3, 2, 1, 15, 17, 7, 144, 6, 52, 70, 1238, 5, 148, 4, 210, 3, 2, 1
Offset: 1

Views

Author

Antti Karttunen, Nov 06 2014

Keywords

Examples

			The top left corner of the array:
1, 2, 3,  4,  5,   6,   7,    8,    9,   10,  11,   12,  13,   14,   15, ...
1, 2, 3,  5,  4,   8,   6,   14,   13,   11,   7,   23,   9,   17,   18, ...
1, 2, 3,  9,  4,  12,   5,   42,   17,   19,   6,   59,   7,   22,   26, ...
1, 2, 3, 14,  4,  21,   5,   92,   33,   25,   6,  144,   7,   32,   39, ...
1, 2, 3, 28,  4,  33,   5,  305,   39,   43,   6,  360,   7,   48,   50, ...
1, 2, 3, 36,  4,  45,   5,  455,   61,   52,   6,  597,   7,   63,   68, ...
1, 2, 3, 57,  4,  63,   5,  944,   70,   76,   6, 1053,   7,   95,   84, ...
1, 2, 3, 67,  4,  80,   5, 1238,   96,   99,   6, 1502,   7,  106,  121, ...
...
		

Crossrefs

Inverse permutations can be found from table A249821.
Row k+1 is a right-to-left composition of the first k rows of A251722.
Row 1: A000027 (an identity permutation), Row 2: A048673, Row 3: A249824, Row 4: A249826.
Column 4: A250474, Column 6: A250477, Column 8: A250478.

Programs

A250477 Number of times prime(n) (the n-th prime) occurs as the least prime factor among numbers 1 .. (prime(n)^2 * prime(n+1)): a(n) = A078898(A251720(n)).

Original entry on oeis.org

6, 8, 12, 21, 33, 45, 63, 80, 116, 148, 182, 232, 265, 296, 356, 433, 490, 548, 625, 674, 740, 829, 919, 1055, 1187, 1252, 1313, 1376, 1446, 1657, 1897, 2029, 2134, 2301, 2484, 2605, 2785, 2946, 3110, 3301, 3439, 3654, 3869, 3978, 4086, 4349, 4811, 5147, 5273, 5395, 5604, 5787, 6049, 6403, 6684, 6954, 7153
Offset: 1

Views

Author

Antti Karttunen, Dec 14 2014

Keywords

Comments

a(n) = Position of 6 on row n of array A249821. This is always larger than A250474(n), the position of 4 on row n, as 4 is guaranteed to be the first composite term on each row of A249821.
From Antti Karttunen, Mar 29 2015: (Start)
a(n) = 1 + number of positive integers <= (prime(n)*prime(n+1)) whose smallest prime factor is at least prime(n).
That a(n) > A250474(n) can also be seen by realizing that prime(n) must occur at least as many times as the smallest prime factor for the numbers in range 1 .. (prime(n)^2 * prime(n+1)) than for numbers in (smaller) range 1 .. (prime(n)^3), and also by realizing that a(n) cannot be equal to A250474(n) because each row of A249822 is a permutation of natural numbers.
Or more simply, by considering the comment given in A256447 which follows from the new interpretation given above.
(End)

Crossrefs

Column 6 of A249822. Cf. also A250474 (column 4), A250478 (column 8).
First differences: A256446. Cf. also A256447, A256448.

Programs

  • Mathematica
    f[n_] := Count[Range[Prime[n]^2*Prime[n + 1]], x_ /; Min[First /@ FactorInteger[x]] == Prime@ n]; Array[f, 20] (* Michael De Vlieger, Mar 30 2015 *)
  • PARI
    allocatemem(234567890);
    A002110(n) = prod(i=1, n, prime(i));
    A250477(n) = { my(m); m = (prime(n) * prime(n+1)); sumdiv(A002110(n-1), d, (moebius(d)*(m\d))); };
    for(n=1, 23, print1(A250477(n),", "));
    \\ A more practical program:
    
  • PARI
    allocatemem(234567890);
    vecsize = (2^24)-4;
    v020639 = vector(vecsize);
    v020639[1] = 1; for(n=2,vecsize, v020639[n] = vecmin(factor(n)[, 1]));
    A020639(n) = v020639[n];
    A250477(n) = { my(p=prime(n),q=prime(n+1),u=p*q,k=1,s=1); while(k <= u, if(A020639(k) >= p, s++); k++); s; };
    for(n=1, 564, write("b250477.txt", n, " ", A250477(n)));
    \\ Antti Karttunen, Mar 29 2015

Formula

a(n) = A078898(A251720(n)).
a(1) = 1, a(n) = Sum_{d | A002110(n-1)} moebius(d) * floor(A006094(n) / d). [Follows when A251720, (p_n)^2 * p_{n+1} is substituted to the similar formula given for A078898. Here p_n is the n-th prime (A000040(n)), A006094(n) gives the product p_n * p{n+1} and A002110(n) gives the product of the first n primes. Because the latter is always squarefree, one could use here also Liouville's lambda (A008836) instead of Moebius mu (A008683)].
a(n) = A250474(n) + A256447(n).
Showing 1-4 of 4 results.