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.

Previous Showing 21-30 of 53 results. Next

A085604 T(n,k) = highest power of prime(k) dividing n!, read by rows.

Original entry on oeis.org

0, 1, 0, 1, 1, 0, 3, 1, 0, 0, 3, 1, 1, 0, 0, 4, 2, 1, 0, 0, 0, 4, 2, 1, 1, 0, 0, 0, 7, 2, 1, 1, 0, 0, 0, 0, 7, 4, 1, 1, 0, 0, 0, 0, 0, 8, 4, 2, 1, 0, 0, 0, 0, 0, 0, 8, 4, 2, 1, 1, 0, 0, 0, 0, 0, 0, 10, 5, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 10, 5, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 11, 5, 2, 2, 1, 1, 0, 0, 0
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 07 2003

Keywords

Comments

T(n,1) = A011371(n); T(n,2) = A054861(n) for n>1;
T(n,k) = number of occurrences of prime(k) as factor in numbers <= n (with repetitions);
Sum{T(n,k): 1<=k<=n} = A022559(n);
T(n, A000720(n)) = 1; T(n,k) = 0, A000720(n)
T(n,k) = A115627(n,k) for n > 1 and k=1..A000720(n). - Reinhard Zumkeller, Nov 01 2013

Examples

			0;
1,0;
1,1,0;
3,1,0,0;
3,1,1,0,0;
4,2,1,0,0,0;
4,2,1,1,0,0,0;
7,2,1,1,0,0,0,0;
7,4,1,1,0,0,0,0,0;
8,4,2,1,0,0,0,0,0,0;
		

Crossrefs

Programs

  • Haskell
    a085604 n k = a085604_tabl !! (n-2) !! (k-1)
    a085604_row 1 = [0]
    a085604_row n = a115627_row n ++ (take $ a062298 $ fromIntegral n) [0,0..]
    a085604_tabl = map a085604_row [1..]
    -- Reinhard Zumkeller, Nov 01 2013
  • Mathematica
    T[n_, k_] := Module[{p = Prime[k], jm}, jm = Floor[Log[p, n]]; Sum[Quotient[n, p^j], {j, 1, jm}]];
    Table[T[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Sep 19 2021 *)

A101203 a(n) = sum of nonprimes <= n.

Original entry on oeis.org

0, 1, 1, 1, 5, 5, 11, 11, 19, 28, 38, 38, 50, 50, 64, 79, 95, 95, 113, 113, 133, 154, 176, 176, 200, 225, 251, 278, 306, 306, 336, 336, 368, 401, 435, 470, 506, 506, 544, 583, 623, 623, 665, 665, 709, 754, 800, 800, 848, 897, 947, 998, 1050, 1050, 1104, 1159, 1215
Offset: 0

Author

Reinhard Zumkeller, Jan 23 2005

Keywords

Crossrefs

Partial sums of A191558.

Programs

  • Haskell
    a101203 n = a101203_list !! (n-1)
    a101203_list = scanl (+) 0 $ zipWith (*) [1..] $ map (1 -) a010051_list
    -- Reinhard Zumkeller, Oct 10 2013
  • Mathematica
    Accumulate[Table[If[PrimeQ[n],0,n],{n,0,60}]] (* Harvey P. Dale, Oct 02 2020 *)
  • PARI
    my(s=0); for(k=0,100,if(!isprime(k),s+=k);print1(s", ")); \\ Cino Hilliard, Feb 04 2006
    

Formula

a(n) = A000217(n) - A034387(n) = A101256(n) + 1.

A065856 The (2^n)-th composite number.

Original entry on oeis.org

4, 6, 9, 15, 26, 48, 88, 168, 323, 627, 1225, 2406, 4736, 9351, 18504, 36655, 72730, 144450, 287147, 571208, 1136971, 2264215, 4510963, 8990492, 17923944, 35743996, 71298762, 142249762, 283859985, 566537515, 1130886504, 2257704401, 4507834166, 9001524190
Offset: 0

Author

Labos Elemer, Nov 26 2001

Keywords

Comments

a(n) = A002808(A000079(n)).

Examples

			composite[1] = composite[2^0] = 4, composite[2] = composite[2^1] = 6, composite[1024] = composite[2^10] = 1225, composite[1073741824] = composite[2^30] = 1130886504.
		

Crossrefs

Programs

  • Mathematica
    Composite[n_Integer] := Block[ {k = n + PrimePi[n] + 1 }, While[ k != n + PrimePi[k] + 1, k = n + PrimePi[k] + 1]; Return[ k ]]; Table[ Composite[2^n], {n, 0, 36} ]

Formula

a(n)-pi(a(n))-1 = 2^n.

Extensions

More terms from Robert G. Wilson v, Nov 26 2001
Definition corrected by N. J. A. Sloane, Jun 07 2009
Further corrections from Reinhard Zumkeller, Jun 24 2009
a(32)-a(33) from Chai Wah Wu, Apr 16 2018

A097454 a(n) = (number of nonprimes <= n) - (number of primes <= n).

Original entry on oeis.org

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

Author

Cino Hilliard, Aug 23 2004

Keywords

Examples

			a(7) = -1 because there are 3 nonprimes <= 7 (1,4 and 6) and 4 primes <= 7 (2,3,5 and 7).
		

Crossrefs

Programs

  • Maple
    with(numtheory): seq(n-2*pi(n), n=1..93); # Emeric Deutsch, Apr 01 2006
  • Mathematica
    qp=0;lst={};Do[If[PrimeQ[n],AppendTo[lst,qp-=1],AppendTo[lst,qp+=1]],{n,6!}];lst (* Vladimir Joseph Stephan Orlovsky, Mar 15 2010 *)
    Accumulate[ -1 + 2 * Boole /@ Not /@ PrimeQ @ Range @ 100] (* Federico Provvedi, Oct 06 2013 *)
  • PARI
    compsmprimes(n) = { for(x=1,n, y=composites(x) - pi(x); print1(y",") ) }
    \\ The number of composite numbers less than or equal to n
    composites(n) = { my(c,x); c=0; for(x=1,n, if(!isprime(x),c++); ); return(c) }
    \\ pi(x) prime count function
    pi(n) = { my(c,x); c=0;forprime(x=1,n,c++);return(c) }

Formula

a(n) = 1 + A072731(n).
a(n) = n - 2*pi(n) = n - 2*A000720(n). - Wesley Ivan Hurt, Jun 16 2013
a(n) - a(n-1) = 1 - 2*A010051(n) for n > 1. - Wesley Ivan Hurt, Dec 18 2018
a(n) = A062298(n) - A000720(n). - Michel Marcus, Jan 31 2019

A257730 Permutation of natural numbers: a(1)=1; a(oddprime(n)) = prime(a(n)), a(not_an_oddprime(n)) = composite(a(n-1)).

Original entry on oeis.org

1, 4, 2, 9, 7, 6, 3, 16, 14, 12, 23, 8, 17, 26, 24, 21, 13, 35, 5, 15, 27, 39, 53, 36, 33, 22, 51, 10, 43, 25, 37, 40, 56, 75, 52, 49, 83, 34, 72, 18, 19, 62, 59, 38, 54, 57, 101, 78, 102, 74, 69, 114, 89, 50, 98, 28, 30, 86, 73, 82, 41, 55, 76, 80, 134, 106, 149, 135, 100, 94, 11, 150, 47, 120, 70, 130, 42, 45, 103, 117, 99, 112, 167, 58, 77
Offset: 1

Author

Antti Karttunen, May 09 2015

Keywords

Comments

Here composite(n) = n-th composite = A002808(n), prime(n) = n-th prime = A000040(n), oddprime(n) = n-th odd prime = A065091(n) = A000040(n+1), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).

Crossrefs

Inverse: A257729.
Related or similar permutations: A246378, A257727, A257732, A257801, A236854.

Formula

a(1) = 1; if A000035(n) = 1 and A010051(n) = 1 [i.e., when n is an odd prime], then a(n) = A000040(a(A000720(n)-1)), otherwise a(n) = A002808(a(A062298(n))). [Here A062298(n) gives the index of n among numbers larger than 1 which are not odd primes, 1 for 2, 2 for 4, 3 for 6, etc.]
As a composition of other permutations:
a(n) = A246378(A257727(n)).
a(n) = A257732(A257801(n)).

A257801 Permutation of natural numbers: a(1)=1; a(oddprime(n)) = lucky(1+a(n)), a(not_an_oddprime(n)) = unlucky(a(n-1)).

Original entry on oeis.org

1, 2, 3, 4, 7, 5, 9, 6, 11, 8, 13, 14, 25, 10, 17, 12, 15, 19, 33, 20, 35, 16, 21, 24, 18, 22, 27, 45, 43, 28, 31, 47, 23, 29, 34, 26, 51, 30, 38, 59, 63, 57, 115, 39, 42, 61, 37, 32, 40, 46, 36, 66, 73, 41, 52, 78, 83, 76, 49, 146, 67, 53, 56, 81, 50, 44, 79, 54, 60, 48, 163, 86, 87, 95, 55, 68, 101, 107, 171, 98, 64
Offset: 1

Author

Antti Karttunen, May 09 2015

Keywords

Comments

Here lucky(n) = n-th lucky number = A000959(n), unlucky(n) = n-th unlucky number = A050505(n), oddprime(n) = n-th odd prime = A065091(n), not_an_oddprime(n) = n-th natural number which is not an odd prime = A065090(n).

Crossrefs

Inverse: A257802.
Related or similar permutations: A257726, A257727, A257730, A257731.

Formula

a(1) = 1; a(2) = 2; if A010051(n) = 1 [i.e., when n is an (odd) prime] then a(n) = A000959(1+a(A000720(n)-1)), otherwise a(n) = A050505(a(A062298(n))).
As a composition of other permutations:
a(n) = A257726(A257727(n)).
a(n) = A257731(A257730(n)).

A316434 a(n) = a(pi(n)) + a(n-pi(n)) with a(1) = a(2) = 1.

Original entry on oeis.org

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

Author

Altug Alkan, Jul 02 2018

Keywords

Comments

This sequence hits every positive integer.

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember: local p;
         p:= numtheory:-pi(n);
         procname(p) + procname(n-p)
    end proc:
    f(1):= 1: f(2):= 1:
    map(f, [$1..100]); # Robert Israel, Jul 03 2018
  • Mathematica
    a[1]=a[2]=1; a[n_] := a[n] = a[PrimePi[n]] + a[n - PrimePi[n]]; Array[a, 75] (* Giovanni Resta, Nov 02 2018 *)
  • PARI
    q=vector(75); for(n=1, 2, q[n] = 1); for(n=3, #q, q[n] = q[primepi(n)] + q[n-primepi(n)]); q
    (C++) See Links section.
    
  • Python
    from sympy import primepi
    def A316434(n):
        pp = primepi(n)
        return 1 if n == 1 or n == 2 else A316434(pp) + A316434(n-pp) # Chai Wah Wu, Nov 02 2018

Formula

a(n) = a(A000720(n)) + a(A062298(n)) with a(1) = a(2) = 1.
a(n+1) - a(n) = 0 or 1 for all n >= 1.

A025003 a(1) = 2; a(n+1) = a(n)-th nonprime, where nonprimes begin at 1.

Original entry on oeis.org

2, 4, 8, 14, 22, 33, 48, 66, 90, 120, 156, 202, 256, 322, 400, 494, 604, 734, 888, 1067, 1272, 1512, 1790, 2107, 2472, 2890, 3364, 3903, 4515, 5207, 5990, 6875, 7868, 8984, 10238, 11637, 13207, 14959, 16909, 19075, 21483, 24173, 27149, 30436, 34080, 38103
Offset: 1

Keywords

Comments

Index of first occurrence of n in A090532.
Let b(n) (n >= 0) be the smallest integer k >= 1 that takes n steps to reach 1 iterating the map f: k -> k - pi(k). The sequence {b(n), n >= 0} begins 1, 2, 4, 8, 14, 22, 33, 48, 66, 90, 120, 156, ... and agrees with the present sequence except for b(0). - Ya-Ping Lu, Sep 07 2020

Examples

			From _Ya-Ping Lu_, Sep 07 2020: (Start)
a(1) = 2 because f(2) = 2 - pi(2) = 1 and m(2) = 1;
For the integer 3, since f(3) = 1. m(3) = 1, which is not bigger than m(1) or m(2). So, 3 is not a term in the sequence;
a(2) = 4 because f^2(4) = f(2) = 1 and m(4) = 2;
a(3) = 8 because f^3(8) = f^2(4) = 1 and m(8) = 3. (End)
		

Programs

  • Maple
    N:= 50: # to get a(0)..a(N)
    V:= Array(0..N):
    V[0]:= 1: V[1]:= 2:
    m:= 2: p:= 3: g:= 1: n:= 1:
    do
      if g+p-m-1 >= V[n] then
        m:= V[n]+m-g;
        n:= n+1;
        V[n]:= m;
        if n = N then break fi;
        g:= V[n-1];
      else
        g:= g+p-m;
        m:= p+1;
        p:= nextprime(m);
      fi;
    od;
    convert(V, list); # Robert Israel, Sep 08 2020
  • Python
    from sympy import prime, primepi
    n_last = 0
    pi_last = 0
    ct_max = -1
    for n in range(1, 100001):
        ct = 0
        pi = pi_last + primepi(n) - primepi(n_last)
        n_c = n
        pi_c = pi
        while n_c > 1:
            nc -= pi_c
            ct += 1
            pi_c -= primepi(n_c + pi_c) - primepi(n_c)
        if ct > ct_max:
            print(n)
            ct_max = ct
        n_last = n
        pi_last = pi # Ya-Ping Lu, Sep 07 2020

Formula

a(n) = min(k: f^n(k) = 1), where f = A062298 and n-fold iteration of f is denoted by f^n. - Ya-Ping Lu, Sep 07 2020

A161865 Numerators of ratio of nonprimes in a square interval to that of nonprimes in that interval and its successor.

Original entry on oeis.org

1, 3, 5, 2, 1, 3, 12, 13, 1, 16, 19, 10, 22, 1, 25, 13, 30, 31, 33, 17, 18, 38, 41, 40, 43, 46, 47, 16, 51, 1, 53, 56, 19, 60, 61, 32, 66, 65, 68, 23, 18, 76, 25, 1, 78, 83, 1, 82, 89, 45, 88, 89, 95, 24, 100, 101, 49, 104, 103, 21, 55, 27, 112, 1, 115, 59, 1, 20, 21, 15, 64, 1
Offset: 1

Author

Daniel Tisdale, Jun 20 2009

Keywords

Examples

			First few terms are 1/4, 3/8, 5/11, 2/5, 1/2, 3/7, 12/25, 13/29.
For n=1: there is 1 nonprime <= 1, 2 nonprimes <= 4, and 5 nonprimes <= 9. The ratio is (2 - 1)/(5 - 1) = 1/4.
		

Crossrefs

Cf. A161621, A161622, A161867 (denominators for this sequence).

Programs

  • Maple
    A062298 := proc(n) n-numtheory[pi](n) ; end: A078435 := proc(n) A062298(n^2) ; end: A161865 := proc(n) r := [ A078435(n),A078435(n+1),A078435(n+2)] ; (r[2]-r[1])/(r[3]-r[1]) ; numer(%) ; end: seq(A161865(n),n=1..120) ; # R. J. Mathar, Sep 27 2009
  • Mathematica
    Numerator[Table[((2 n + 1) - (PrimePi[(n + 1)^2] - PrimePi[n^2]))/((4 n + 4) - (PrimePi[(n + 2)^2] - PrimePi[n^2])), {n, 1, 40}]] (* corrected by G. C. Greubel, Dec 20 2016 *)

Formula

The limit of this sequence is 1/2, as can be shown by setting an increasing lower bound on the ratio of composites in successive square intervals.

Extensions

Extended beyond a(8) by R. J. Mathar, Sep 27 2009

A255573 a(n) = Number of terms of A205783 (including 1) in range 0 .. n.

Original entry on oeis.org

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

Author

Antti Karttunen, May 14 2015

Keywords

Crossrefs

Essentially one more than A255572 (after the initial zero).

Programs

  • PARI
    A255573_write_bfile(up_to_n) = { my(n,a_n=0); for(n=0, up_to_n, if(((n > 0) && !polisirreducible(Pol(binary(n)))),a_n++); write("b255573.txt", n, " ", a_n)); };
    A255573_write_bfile(8192);

Formula

a(n) = n - A255574(n).
Other identities and observations. For all n >= 1:
a(n) = 1 + A255572(n).
a(n) <= A062298(n).
Previous Showing 21-30 of 53 results. Next