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

A002808 The composite numbers: numbers n of the form x*y for x > 1 and y > 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The natural numbers 1,2,... are divided into three sets: 1 (the unit), the primes (A000040) and the composite numbers (A002808).
The number of composite numbers <= n (A065855) = n - pi(n) (A000720) - 1.
n is composite iff sigma(n) + phi(n) > 2n. This is a nice result of the well known theorem: For all positive integers n, n = Sum_{d|n} phi(d). For the proof see my contribution to puzzle 76 of Carlos Rivera's Primepuzzles. - Farideh Firoozbakht, Jan 27 2005, Jan 18 2015
The composite numbers have the semiprimes A001358 as primitive elements.
A211110(a(n)) > 1. - Reinhard Zumkeller, Apr 02 2012
A060448(a(n)) > 1. - Reinhard Zumkeller, Apr 05 2012
A086971(a(n)) > 0. - Reinhard Zumkeller, Dec 14 2012
Composite numbers n which are the product of r=A001222(n) prime numbers are sometimes called r-almost primes. Sequences listing r-almost primes are: A000040 (r = 1), A001358 (r = 2), A014612 (r = 3), A014613 (r = 4), A014614 (r = 5), A046306 (r = 6), A046308 (r = 7), A046310 (r = 8), A046312 (r = 9), A046314 (r = 10), A069272 (r = 11), A069273 (r = 12), A069274 (r = 13), A069275 (r = 14), A069276 (r = 15), A069277 (r = 16), A069278 (r = 17), A069279 (r = 18), A069280 (r = 19), A069281 (r = 20). - Jason Kimberley, Oct 02 2011
a(n) = A056608(n) * A160180(n). - Reinhard Zumkeller, Mar 29 2014
Degrees for which there are irreducible polynomials which are reducible mod p for all primes p, see Brandl. - Charles R Greathouse IV, Sep 04 2014
An integer is composite if and only if it is the sum of strictly positive integers in arithmetic progression with common difference 2: 4 = 1 + 3, 6 = 2 + 4, 8 = 3 + 5, 9 = 1 + 3 + 5, etc. - Jean-Christophe Hervé, Oct 02 2014
This statement holds since k+(k+2)+...+k+2(n-1) = n*(n+k-1) = a*b with arbitrary a,b (taking n=a and k=b-a+1 if b>=a). - M. F. Hasler, Oct 04 2014
For n > 4, these are numbers n such that n!/n^2 = (n-1)!/n is an integer (see A056653). - Derek Orr, Apr 16 2015
Let f(x) = Sum_{i=1..x} Sum_{j=2..i-1} cos((2*Pi*x*j)/i). It is known that the zeros of f(x) are the prime numbers. So these are the numbers n such that f(n) > 0. - Michel Lagneau, Oct 13 2015
Numbers n that can be written as solutions of the Diophantine equation n = (x+2)(y+2) where {x,y} in N^2, pairs of natural numbers including zero (cf. Mathematica code and Davis). - Ron R Spencer and Bradley Klee, Aug 15 2016
Numbers n with a partition (containing at least two summands) so that its summands also multiply to n. If n is prime, there is no way to find those two (or more) summands. If n is composite, simply take a factor or several, write those divisors and fill with enough 1's so that they add up to n. For example: 4 = 2*2 = 2+2, 6 = 1*2*3 = 1+2+3, 8 = 1*1*2*4 = 1+1+2+4, 9 = 1*1*1*3*3 = 1+1+1+3+3. - Juhani Heino, Aug 02 2017

References

  • T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 2.
  • A. E. Bojarincev, Asymptotic expressions for the n-th composite number, Univ. Mat. Zap. 6:21-43 (1967). - In Russian.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 127.
  • Martin Davis, "Algorithms, Equations, and Logic", pp. 4-15 of S. Barry Cooper and Andrew Hodges, Eds., "The Once and Future Turing: Computing the World", Cambridge 2016.
  • R. K. Guy, Unsolved Problems Number Theory, Section A.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 2.
  • D. R. Hofstadter, Goedel, Escher, Bach: an Eternal Golden Braid, Random House, 1980, p. 66.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 51.
  • 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).

Crossrefs

Complement of A008578. - Omar E. Pol, Dec 16 2016
Cf. A073783 (first differences), A073445 (second differences).
Boustrophedon transforms: A230954, A230955.
Cf. A163870 (nontrivial divisors).
Related sequences:
Primes (p) and composites (c): A000040, A002808, A000720, 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
    a002808 n = a002808_list !! (n-1)
    a002808_list = filter ((== 1) . a066247) [2..]
    -- Reinhard Zumkeller, Feb 04 2012
    
  • Magma
    [n: n in [2..250] | not IsPrime(n)]; // G. C. Greubel, Feb 24 2024
    
  • Maple
    t := []: for n from 2 to 20000 do if isprime(n) then else t := [op(t),n]; fi; od: t; remove(isprime,[$3..89]); # Zerinvary Lajos, Mar 19 2007
    A002808 := proc(n) option remember ; local a ; if n = 1 then 4; else for a from procname(n-1)+1 do if not isprime(a) then return a; end if; end do ; end if; end proc; # R. J. Mathar, Oct 27 2009
  • Mathematica
    Select[Range[2,100], !PrimeQ[#]&] (* Zak Seidov, Mar 05 2011 *)
    With[{nn=100},Complement[Range[nn],Prime[Range[PrimePi[nn]]]]] (* Harvey P. Dale, May 01 2012 *)
    Select[Range[100], CompositeQ] (* Jean-François Alcover, Nov 07 2021 *)
  • PARI
    A002808(n)=for(k=0,primepi(n),isprime(n++)&&k--);n \\ For illustration only: see below. - M. F. Hasler, Oct 31 2008
    
  • PARI
    A002808(n)= my(k=-1); while(-n + n += -k + k=primepi(n),); n \\ For n=10^4 resp. 3*10^4, this is about 100 resp. 500 times faster than the former; M. F. Hasler, Nov 11 2009
    
  • PARI
    forcomposite(n=1, 1e2, print1(n, ", ")) \\ Felix Fröhlich, Aug 03 2014
    
  • PARI
    for(n=1, 1e3, if(bigomega(n) > 1, print1(n, ", "))) \\ Altug Alkan, Oct 14 2015
    
  • Python
    from sympy import primepi
    def A002808(n):
        m, k = n, primepi(n) + 1 + n
        while m != k:
            m, k = k, primepi(k) + 1 + n
        return m # Chai Wah Wu, Jul 15 2015, updated Apr 14 2016
    
  • Python
    from sympy import isprime
    def ok(n): return n > 1 and not isprime(n)
    print([k for k in range(89) if ok(k)]) # Michael S. Branicky, Nov 07 2021
    
  • Python
    next_A002808=lambda n: next(n for n in range(n,n*5)if not isprime(n)) # next composite >= n > 0; next_A002808(n)==n <=> iscomposite(n). - M. F. Hasler, Mar 28 2025
    is_A002808=lambda n:not isprime(n) and n>1 # where isprime(n) can be replaced with: all(n%d for d in range(2, int(n**.5)+1))
    # generators of composite numbers:
    A002808_upto=lambda stop=1<<59: filter(is_A002808, range(2,stop))
    A002808_seq=lambda:(q:=2)and(n for p in primes if (o:=q)<(q:=p) for n in range(o+1,p)) # with, e.g.: primes=filter(isprime,range(2,1<<59)) # M. F. Hasler, Mar 28 2025
    
  • SageMath
    [n for n in (2..250) if not is_prime(n)] # G. C. Greubel, Feb 24 2024

Formula

a(n) = pi(a(n)) + 1 + n, where pi is the prime counting function.
a(n) = A136527(n, n).
A000005(a(n)) > 2. - Juri-Stepan Gerasimov, Oct 17 2009
A001222(a(n)) > 1. - Juri-Stepan Gerasimov, Oct 30 2009
A000203(a(n)) < A007955(a(n)). - Juri-Stepan Gerasimov, Mar 17 2011
A066247(a(n)) = 1. - Reinhard Zumkeller, Feb 05 2012
Sum_{n>=1} 1/a(n)^s = Zeta(s)-1-P(s), where P is prime zeta. - Enrique Pérez Herrero, Aug 08 2012
n + n/log n + n/log^2 n < a(n) < n + n/log n + 3n/log^2 n for n >= 4, see Panaitopol. Bojarincev gives an asymptotic version. - Charles R Greathouse IV, Oct 23 2012
a(n) > n + A000720(n) + 1. - François Huppé, Jan 08 2025

Extensions

Deleted an incomplete and broken link. - N. J. A. Sloane, Dec 16 2010

A018252 The nonprime numbers: 1 together with the composite numbers, A002808.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

d(a(n)) != 2 (cf. A000005). - Juri-Stepan Gerasimov, Oct 17 2009
Number of prime divisors of a(n) (counted with multiplicity) != 1. - Juri-Stepan Gerasimov, Oct 30 2009
Largest nonprime < n-th composite. - Juri-Stepan Gerasimov, Oct 29 2009
The nonnegative nonprimes A141468 without zero; the natural nonprimes; the whole nonprimes; the counting nonprimes. If the nonprime numbers A141468 which are also the nonnegative integers A001477, then the nonprimes A141468 also called the nonnegative nonprimes. If the nonprime numbers A018252 which are also the natural (or whole or counting) numbers A000027, then the nonprimes A018252 also called the natural nonprimes, the whole nonprimes and the counting nonprimes. - Juri-Stepan Gerasimov, Nov 22 2009
Smallest nonprime > n-th nonnegative nonprime. - Juri-Stepan Gerasimov, Dec 04 2009
a(n) = A175944(A014284(n)) = A175944(A175965(n)). - Reinhard Zumkeller, Mar 18 2011

References

  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 2.

Crossrefs

Cf. A000040 (complement), A002808.
Boustrophedon transforms: A230955, A230954.

Programs

  • GAP
    A018252 := Difference([1..10^5], Filtered([1..10^5], IsPrime)); # Muniru A Asiru, Oct 21 2017
    
  • Haskell
    a018252 n = a018252_list !! (n-1)
    a018252_list = filter ((== 0) . a010051) [1..]
    -- Reinhard Zumkeller, Mar 31 2014
    
  • Magma
    [n : n in [1..100] | not IsPrime(n) ];
    
  • Maple
    with(numtheory); sort(convert(convert([ seq(i,i=1..541) ],set) minus convert([ seq(ithprime(i),i=1..100) ],set),list));
    seq(`if`(not isprime(n),n,NULL),n=1..88); # Peter Luschny, Jul 29 2009
    A018252 := proc(n) option remember; if n = 1 then 1; else for a from procname(n-1)+1 do if not isprime(a) then return a; end if; end do; end if; end proc: # R. J. Mathar, Oct 22 2010
  • Mathematica
    nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n + PrimePi@ n]; Array[ nonPrime, 75] (* Robert G. Wilson v, Jan 29 2015, based on the algorithm by Labos Elemer in A006508 *)
    max = 90; Complement[Range[max], Prime[Range[PrimePi[max]]]] (* Harvey P. Dale, Aug 12 2011 *)
    Join[{1}, Select[Range[100], CompositeQ]] (* Jean-François Alcover, Nov 07 2021 *)
  • PARI
    isA018252(n) = !isprime(n)
    A018252(n) = {local(a,b);b=n;a=1;while(a!=b,a=b;b=n+primepi(a));b} \\ Michael B. Porter, Nov 06 2009
    
  • PARI
    a(n) = my(k=0); while(-n+n-=k-k=primepi(n), ); n; \\ Ruud H.G. van Tol, Jul 15 2024 (after code in A002808)
    
  • Python
    from sympy import isprime
    def ok(n): return not isprime(n)
    print([k for k in range(1, 89) if ok(k)]) # Michael S. Branicky, Nov 10 2022
    
  • Python
    from sympy import composite
    def A018252(n): return 1 if n == 1 else composite(n-1) # Chai Wah Wu, Nov 15 2022
  • Sage
    def A018252_list(n) :
        return [k for k in (1..n) if not k.is_prime()]
    A018252_list(88)  # Peter Luschny, Feb 03 2012
    

Formula

Let b(0) = n + pi(n) and b(n+1) = n + pi(b(n)), with pi(n) = A000720(n); then a(n) is the limit value of b(n). - Floor van Lamoen, Oct 08 2001
a(n) = A137621(A137624(n)). - Reinhard Zumkeller, Jan 30 2008
A010051(a(n)) = 0. - Reinhard Zumkeller, Mar 31 2014
A239968(a(n)) = n. - Reinhard Zumkeller, Dec 02 2014

A000747 Boustrophedon transform of primes.

Original entry on oeis.org

2, 5, 13, 35, 103, 345, 1325, 5911, 30067, 172237, 1096319, 7677155, 58648421, 485377457, 4326008691, 41310343279, 420783672791, 4553946567241, 52184383350787, 631210595896453, 8036822912123765, 107444407853010597, 1504827158220643895, 22034062627659931905
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a000747 n = sum $ zipWith (*) (a109449_row n) a000040_list
    -- Reinhard Zumkeller, Nov 03 2013
    
  • Mathematica
    t[n_, 0] := Prime[n+1]; t[n_, k_] := t[n, k] = t[n, k-1] + t[n-1, n-k]; a[n_] := t[n, n]; Array[a, 30, 0] (* Jean-François Alcover, Feb 12 2016 *)
  • Python
    from itertools import islice, count, accumulate
    from sympy import prime
    def A000747_gen(): # generator of terms
        blist = tuple()
        for i in count(1):
            yield (blist := tuple(accumulate(reversed(blist),initial=prime(i))))[-1]
    A000747_list = list(islice(A000747_gen(),30)) # Chai Wah Wu, Jun 11 2022

Formula

a(n) = Sum_{k=0..n} A109449(n,k)*A000040(k+1). - Reinhard Zumkeller, Nov 03 2013
E.g.f.: (sec(x) + tan(x)) * Sum_{k>=0} prime(k+1)*x^k/k!. - Ilya Gutkovskiy, Jun 26 2018

A230953 Boustrophedon transform of odd primes, cf. A065091.

Original entry on oeis.org

3, 8, 20, 53, 154, 505, 1944, 8651, 44046, 252271, 1605874, 11245261, 85907084, 710970323, 6336648426, 60510526207, 616355168958, 6670526004559, 76438597647616, 924584128977111, 11772170758462928, 157382330019694067, 2204239468545788024, 32275035859881159165
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 03 2013

Keywords

Crossrefs

Programs

  • Haskell
    a230953 n = sum $ zipWith (*) (a109449_row n) $ tail a000040_list
    
  • Mathematica
    t[n_, 0] := Prime[n+2]; t[n_, k_] := t[n, k] = t[n, k-1] + t[n-1, n-k]; a[n_] := t[n, n]; Array[a, 30, 0] (* Jean-François Alcover, Feb 12 2016 *)
  • Python
    from itertools import accumulate, count, islice
    from sympy import prime
    def A230953_gen(): # generator of terms
        blist = tuple()
        for i in count(2):
            yield (blist := tuple(accumulate(reversed(blist),initial=prime(i))))[-1]
    A230953_list = list(islice(A230953_gen(),40)) # Chai Wah Wu, Jun 12 2022

Formula

a(n) = Sum_{k=0..n} A109449(n,k)*A000040(k+2).
E.g.f.: (sec(x) + tan(x)) * Sum_{k>=0} prime(k+2)*x^k/k!. - Ilya Gutkovskiy, Jun 26 2018

A230955 Boustrophedon transform of nonprimes.

Original entry on oeis.org

1, 5, 15, 40, 114, 371, 1422, 6334, 32238, 184655, 1175454, 8231308, 62882262, 520416569, 4638303786, 44292536061, 451160065069, 4882696090609, 55951575728713, 676777708544967, 8617001415386120, 115200823068725262, 1613460678695102980, 23624702309844184487
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 03 2013

Keywords

Crossrefs

Programs

  • Haskell
    a230955 n = sum $ zipWith (*) (a109449_row n) a018252_list
    
  • Mathematica
    cc = Select[Range[max = 40], !PrimeQ[#]&]; t[n_, 0] := cc[[n+1]]; t[n_, k_] := t[n, k] = t[n, k-1] + t[n-1, n-k]; a[n_] := t[n, n]; Array[a, cc // Length, 0] (* Jean-François Alcover, Feb 12 2016 *)
  • Python
    from itertools import accumulate, count, islice
    from sympy import composite
    def A230955_gen(): # generator of terms
        yield 1
        blist = (1,)
        for i in count(1):
            yield (blist := tuple(accumulate(reversed(blist),initial=composite(i))))[-1]
    A230955_list = list(islice(A230955_gen(),40)) # Chai Wah Wu, Jun 12 2022

Formula

a(n) = Sum_{k=0..n} A109449(n,k)*A018252(k+1).

A000732 Boustrophedon transform of 1 & primes: 1,2,3,5,7,...

Original entry on oeis.org

1, 3, 8, 22, 66, 222, 862, 3838, 19542, 111894, 712282, 4987672, 38102844, 315339898, 2810523166, 26838510154, 273374835624, 2958608945772, 33903161435148, 410085034127000, 5221364826476796, 69804505809732988
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a000732 n = sum $ zipWith (*) (a109449_row n) a008578_list
    
  • Mathematica
    t[n_, 0] := If[n==0, 1, Prime[n]]; t[n_, k_] := t[n, k] = t[n, k-1] + t[n-1, n-k]; a[n_] := t[n, n]; Array[a, 30, 0] (* Jean-François Alcover, Feb 12 2016 *)
  • Python
    from itertools import accumulate, count, islice
    from sympy import prime
    def A000732_gen(): # generator of terms
        yield 1
        blist = (1,)
        for i in count(1):
            yield (blist := tuple(accumulate(reversed(blist),initial=prime(i))))[-1]
    A000732_list = list(islice(A000732_gen(),40)) # Chai Wah Wu, Jun 12 2022

Formula

a(n) = Sum_{k=0..n} A109449(n,k)*A008578(k+1). - Reinhard Zumkeller, Nov 04 2013
E.g.f.: (sec(x) + tan(x))*(1 + Sum_{k>=1} prime(k)*x^k/k!). - Ilya Gutkovskiy, Apr 23 2019
Showing 1-6 of 6 results.