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

A179278 Largest nonprime integer <= n.

Original entry on oeis.org

1, 1, 1, 4, 4, 6, 6, 8, 9, 10, 10, 12, 12, 14, 15, 16, 16, 18, 18, 20, 21, 22, 22, 24, 25, 26, 27, 28, 28, 30, 30, 32, 33, 34, 35, 36, 36, 38, 39, 40, 40, 42, 42, 44, 45, 46, 46, 48, 49, 50, 51, 52, 52, 54, 55, 56, 57, 58, 58, 60, 60, 62, 63, 64, 65, 66, 66, 68, 69, 70, 70, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 08 2010

Keywords

Examples

			From _Gus Wiseman_, Dec 04 2024: (Start)
The nonprime integers <= n:
  1  1  1  4  4  6  6  8  9  10  10  12  12  14  15  16
           1  1  4  4  6  8  9   9   10  10  12  14  15
                 1  1  4  6  8   8   9   9   10  12  14
                       1  4  6   6   8   8   9   10  12
                          1  4   4   6   6   8   9   10
                             1   1   4   4   6   8   9
                                     1   1   4   6   8
                                             1   4   6
                                                 1   4
                                                     1
(End)
		

Crossrefs

For prime we have A007917.
For nonprime we have A179278 (this).
For squarefree we have A070321.
For nonsquarefree we have A378033.
For prime power we have A031218.
For non prime power we have A378367.
For perfect power we have A081676.
For non perfect power we have A378363.
A000040 lists the primes, differences A001223.
A002808 lists the composite numbers, differences A073783.
A018252 lists the nonprimes, differences A065310.
A095195 has row n equal to the k-th differences of the prime numbers.
A113646 gives least nonprime >= n.
A151800 gives the least prime > n, weak version A007918.
A377033 has row n equal to the k-th differences of the composite numbers.

Programs

  • Mathematica
    Array[# - Boole[PrimeQ@ #] - Boole[# == 3] &, 72] (* Michael De Vlieger, Oct 13 2018 *)
    Table[Max@@Select[Range[n],!PrimeQ[#]&],{n,30}] (* Gus Wiseman, Dec 04 2024 *)
  • PARI
    a(n) = if (isprime(n), if (n==3, 1, n-1), n); \\ Michel Marcus, Oct 13 2018

Formula

For n > 3: a(n) = A113523(n) = A014684(n);
For n > 0: a(n) = A113638(n). - Georg Fischer, Oct 12 2018
A005171(a(n)) = 1; A010051(a(n)) = 0.
a(n) = A018252(A062298(n)). - Ridouane Oudra, Aug 22 2025

Extensions

Inequality in the name reversed by Gus Wiseman, Dec 05 2024

A113638 In the sequence of nonnegative integers subtract 1 from each prime number.

Original entry on oeis.org

0, 1, 1, 2, 4, 4, 6, 6, 8, 9, 10, 10, 12, 12, 14, 15, 16, 16, 18, 18, 20, 21, 22, 22, 24, 25, 26, 27, 28, 28, 30, 30, 32, 33, 34, 35, 36, 36, 38, 39, 40, 40, 42, 42, 44, 45, 46, 46, 48, 49, 50, 51, 52, 52, 54, 55, 56, 57, 58, 58, 60, 60, 62, 63, 64, 65, 66, 66, 68, 69, 70, 70, 72
Offset: 0

Views

Author

Cino Hilliard, Jan 15 2006

Keywords

Crossrefs

Cf. A014684.

Programs

  • Mathematica
    Table[If[PrimeQ[n],n-1,n],{n,0,80}] (* Harvey P. Dale, Sep 10 2017 *)
  • Python
    from sympy import isprime
    def A113638(n): return n-int(isprime(n)) # Chai Wah Wu, Oct 14 2023

Formula

a(n) = A014684(n), n>0. - R. J. Mathar, Aug 13 2008

Extensions

Name corrected by Wolfdieter Lang, Apr 22 2015

A113523 a(n) = largest composite nonnegative integer <= n.

Original entry on oeis.org

0, 0, 0, 4, 4, 6, 6, 8, 9, 10, 10, 12, 12, 14, 15, 16, 16, 18, 18, 20, 21, 22, 22, 24, 25, 26, 27, 28, 28, 30, 30, 32, 33, 34, 35, 36, 36, 38, 39, 40, 40, 42, 42, 44, 45, 46, 46, 48, 49, 50, 51, 52, 52, 54, 55, 56, 57, 58, 58, 60, 60, 62, 63, 64, 65, 66, 66, 68, 69, 70, 70, 72
Offset: 1

Views

Author

Leroy Quet, Jan 12 2006

Keywords

Comments

For n > 3: a(n) = A179278(n). [From Reinhard Zumkeller, Jul 08 2010]

Crossrefs

Programs

  • Mathematica
    nnci[n_]:=Module[{k=0},While[PrimeQ[n-k],k++];n-k]/.{1->0}; Array[nnci,80] (* Harvey P. Dale, Jul 19 2012 *)

Formula

a(1)=a(2)=a(3) = 0. For n >= 4, a(n) = A014684(n).

A256885 a(n) = n*(n + 1)/2 - pi(n), where pi(n) = A000720(n) is the prime counting function.

Original entry on oeis.org

1, 2, 4, 8, 12, 18, 24, 32, 41, 51, 61, 73, 85, 99, 114, 130, 146, 164, 182, 202, 223, 245, 267, 291, 316, 342, 369, 397, 425, 455, 485, 517, 550, 584, 619, 655, 691, 729, 768, 808, 848, 890, 932, 976, 1021, 1067, 1113, 1161, 1210, 1260, 1311, 1363, 1415, 1469, 1524
Offset: 1

Views

Author

Wesley Ivan Hurt, Apr 11 2015

Keywords

Comments

Number of lattice points (x,y) in the region 1 <= x <= n, 1 <= y <= n - A010051(n); see example.
This sequence gives the row sums of the triangle A257232. - Wolfdieter Lang, Apr 21 2015

Examples

			10 .                             x
9  .                          x  x
8  .                       x  x  x
7  .                    .  x  x  x
6  .                 x  x  x  x  x
5  .              .  x  x  x  x  x
4  .           x  x  x  x  x  x  x
3  .        .  x  x  x  x  x  x  x
2  .     .  x  x  x  x  x  x  x  x
1  .  x  x  x  x  x  x  x  x  x  x
0  .__.__.__.__.__.__.__.__.__.__.
   0  1  2  3  4  5  6  7  8  9  10
		

Crossrefs

Programs

  • Haskell
    a256885 n = a000217 n - a000720 n  -- Reinhard Zumkeller, Apr 21 2015
  • Magma
    [n*(n + 1)/2 - #PrimesUpTo(n): n in [1..60] ]; // Vincenzo Librandi, Apr 12 2015
    
  • Maple
    with(numtheory)[pi]: A256885:=n->n*(n+1)/2-pi(n): seq(A256885(n), n=1..100);
  • Mathematica
    Table[n (n + 1)/2 - PrimePi[n], {n, 1, 50}]
  • PARI
    vector(80, n, n*(n+1)/2 - primepi(n)) \\ Michel Marcus, Apr 13 2015
    

Formula

a(n) = A000217(n) - A000720(n).
a(n) - a(n-1) = A014684(n), n >= 2.
a(n) = Sum_{i=1..n} A014684(i).
a(n) = 1 + Sum_{i=2..n}(i - A000720(i) + A000720(i-1)).

Extensions

Edited, following the hint by Reinhard Zumkeller to change the offset. - Wolfdieter Lang, Apr 22 2015

A284383 a(1) = 1, a(2) = 2, a(3) = 3, a(4) = 2; a(n) is the largest composite number <= (a(n-a(n-1)) + a(n-a(n-2))) for n > 4.

Original entry on oeis.org

1, 2, 3, 2, 4, 4, 6, 4, 6, 6, 8, 6, 10, 6, 10, 10, 12, 8, 14, 10, 14, 10, 16, 10, 16, 16, 16, 12, 22, 12, 20, 16, 22, 14, 24, 16, 24, 16, 26, 16, 26, 26, 24, 18, 30, 22, 28, 26, 30, 20, 34, 24, 36, 20, 38, 24, 36, 24, 40, 26, 38, 26, 40, 26, 42, 26, 42, 42, 32, 28, 50, 28, 46, 34
Offset: 1

Views

Author

Altug Alkan, Mar 26 2017

Keywords

Examples

			a(5) = 4 because a(5 - a(4)) + a(5 - a(3)) = a(3) + a(2) = 3 + 2 = 5 and largest composite number <= 5 is 4.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[n <= 4, n - 2 Boole[n == 4], k = 0; While[! CompositeQ@ Set[m, a[n - a[n - 1]] + a[n - a[n - 2]] - k], k++]; m]; Array[a, 74] (* Michael De Vlieger, Mar 29 2017 *)
  • PARI
    f(n) = n-isprime(n);
    a=vector(1000); a[1]=1;a[2]=2;a[3]=3; for(n=4, #a, a[n] = f(a[n-a[n-1]]+a[n-a[n-2]])); a

Formula

a(1) = 1, a(2) = 2, a(3) = 3; a(n) = a(n-a(n-1)) + a(n-a(n-2)) - A010051(a(n-a(n-1)) + a(n-a(n-2))) for n > 3.

A080786 Triangle T(n,k) = number of k-smooth numbers <= n, read by rows.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 3, 4, 4, 1, 3, 4, 4, 5, 1, 3, 5, 5, 6, 6, 1, 3, 5, 5, 6, 6, 7, 1, 4, 6, 6, 7, 7, 8, 8, 1, 4, 7, 7, 8, 8, 9, 9, 9, 1, 4, 7, 7, 9, 9, 10, 10, 10, 10, 1, 4, 7, 7, 9, 9, 10, 10, 10, 10, 11, 1, 4, 8, 8, 10, 10, 11, 11, 11, 11, 12, 12, 1, 4, 8, 8, 10, 10, 11, 11, 11, 11, 12, 12, 13, 1, 4
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 12 2003

Keywords

Comments

T(n,n-1) = A014684(n) for n>1;
T(n,2) = A029837(n) for n>1; T(n,3) = A071521(n) for n>2; T(n,5) = A071520(n) for n>4.
A036234(n) = number of distinct terms in n-th row. - Reinhard Zumkeller, Sep 17 2013

Examples

			Triangle begins:
.................. 1
................ 1...2
.............. 1...2...3
............ 1...3...4...4
.......... 1...3...4...4...5
........ 1...3...5...5...6...6
...... 1...3...5...5...6...6...7
.... 1...4...6...6...7...7...8...8
.. 1...4...7...7...8...8...9...9...9.
		

Crossrefs

Programs

  • Haskell
    a080786 n k = a080786_tabl !! (n-1) !! (k-1)
    a080786_row n = a080786_tabl !! (n-1)
    a080786_tabl = map reverse $ iterate f [1] where
       f xs@(x:_) = (x + 1) :
                    (zipWith (+) xs (map (fromEnum . (lpf <=)) [x, x-1 ..]))
            where lpf = fromInteger $ a006530 $ fromIntegral (x + 1)
    -- Reinhard Zumkeller, Sep 17 2013
    
  • Maple
    A080786 := proc(x,y)
        local a,n ;
        a := 0 ;
        for n from 1 to x do
            if A006530(n) <= y then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Aug 31 2013
  • Mathematica
    P[n_] := FactorInteger[n][[-1, 1]]; P[1]=1; T[n_, k_] := (For[j=0; m=1, m <= n, m++, If[P[m] <= k, j++]]; j); Table[T[n, k], {n, 1, 15}, {k, 1, n}] // Flatten (* Jean-François Alcover, Nov 22 2015 *)
  • Python
    from itertools import count, islice
    from sympy import prevprime, integer_log
    def A080786_T(n,k):
        if k==1: return 1
        def g(x,m): return x.bit_length() if m==2 else sum(g(x//(m**i),prevprime(m))for i in range(integer_log(x,m)[0]+1))
        return g(n,prevprime(k+1))
    def A080786_gen(): # generator of terms
        return (A080786_T(n,k) for n in count(1) for k in range(1,n+1))
    A080786_list = list(islice(A080786_gen(),100)) # Chai Wah Wu, Oct 22 2024

A135681 a(n)=n if n=1 or if n=prime. Otherwise, n=4 if n is even and n=1 if n is odd.

Original entry on oeis.org

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

Views

Author

Mohammad K. Azarian, Dec 01 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := If[PrimeQ[n] || n == 1, n, If[EvenQ[n], 4, 1] ]; Table[a[n], {n,1,25}] (* G. C. Greubel, Oct 26 2016 *)

A113636 In the sequence of positive integers add 1 to each nonprime number.

Original entry on oeis.org

2, 2, 3, 5, 5, 7, 7, 9, 10, 11, 11, 13, 13, 15, 16, 17, 17, 19, 19, 21, 22, 23, 23, 25, 26, 27, 28, 29, 29, 31, 31, 33, 34, 35, 36, 37, 37, 39, 40, 41, 41, 43, 43, 45, 46, 47, 47, 49, 50, 51, 52, 53, 53, 55, 56, 57, 58, 59, 59, 61, 61, 63, 64, 65, 66, 67, 67, 69, 70, 71, 71, 73
Offset: 1

Views

Author

Cino Hilliard, Jan 15 2006

Keywords

Comments

This is the complement of sequence A014683.
Möbius transform of A380449(n). - Wesley Ivan Hurt, Jun 21 2025

Crossrefs

Programs

  • Mathematica
    Array[# + Boole[! PrimeQ@ #] &, 72] (* Michael De Vlieger, Nov 05 2020 *)
  • PARI
    a(n) = if (!isprime(n), n+1, n); \\ Michel Marcus, Nov 06 2020

Formula

a(n) = A014684(n) + 1. - Bill McEachen, Nov 01 2020
From Wesley Ivan Hurt, Jun 21 2025: (Start)
a(n) = n + c(n), where c = A005171.
a(n) = Sum_{d|n} A380449(d) * mu(n/d). (End)

Extensions

Offset 1 from Michel Marcus, Nov 06 2020

A135682 a(n)=n if n=1 or if n=prime. Otherwise, n=4 if n is even and n=7 if n is odd.

Original entry on oeis.org

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

Views

Author

Mohammad K. Azarian, Dec 01 2007

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := If[PrimeQ[n] || n == 1, n, If[EvenQ[n], 4, 7] ]; Table[a[n], {n,1,25}] (* G. C. Greubel, Oct 26 2016 *)

A135684 a(n)=11 if n is a prime number. Otherwise, a(n)=n.

Original entry on oeis.org

1, 11, 11, 4, 11, 6, 11, 8, 9, 10, 11, 12, 11, 14, 15, 16, 11, 18, 11, 20, 21, 22, 11, 24, 25, 26, 27, 28, 11, 30, 11, 32, 33, 34, 35, 36, 11, 38, 39, 40, 11, 42, 11, 44, 45, 46, 11, 48, 49, 50, 51, 52, 11, 54, 55, 56, 57, 58, 11
Offset: 1

Views

Author

Mohammad K. Azarian, Dec 01 2007

Keywords

Crossrefs

Programs

  • Magma
    [IsPrime(n) select 11 else n: n in [1..70]]; // Vincenzo Librandi, Feb 22 2013
  • Mathematica
    Table[If[PrimeQ[n], 11, n], {n, 70}] (* Vincenzo Librandi, Feb 22 2013 *)
Showing 1-10 of 11 results. Next