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.

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

This page as a plain text file.
%I A018252 #97 Feb 16 2025 08:32:33
%S A018252 1,4,6,8,9,10,12,14,15,16,18,20,21,22,24,25,26,27,28,30,32,33,34,35,
%T A018252 36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56,57,58,60,62,63,64,65,
%U A018252 66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88
%N A018252 The nonprime numbers: 1 together with the composite numbers, A002808.
%C A018252 d(a(n)) != 2 (cf. A000005). - _Juri-Stepan Gerasimov_, Oct 17 2009
%C A018252 Number of prime divisors of a(n) (counted with multiplicity) != 1. - _Juri-Stepan Gerasimov_, Oct 30 2009
%C A018252 Largest nonprime < n-th composite. - _Juri-Stepan Gerasimov_, Oct 29 2009
%C A018252 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
%C A018252 Smallest nonprime > n-th nonnegative nonprime. - _Juri-Stepan Gerasimov_, Dec 04 2009
%C A018252 a(n) = A175944(A014284(n)) = A175944(A175965(n)). - _Reinhard Zumkeller_, Mar 18 2011
%D A018252 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 2.
%H A018252 N. J. A. Sloane, <a href="/A018252/b018252.txt">List of nonprimes up to 20000: Table of n, a(n) for n = 1..17738</a>
%H A018252 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/MonicaSet.html">Monica Set</a>
%H A018252 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SuzanneSet.html">Suzanne Set</a>
%H A018252 <a href="/index/Cor#core">Index entries for "core" sequences</a>
%F A018252 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
%F A018252 a(n) = A137621(A137624(n)). - _Reinhard Zumkeller_, Jan 30 2008
%F A018252 A010051(a(n)) = 0. - _Reinhard Zumkeller_, Mar 31 2014
%F A018252 A239968(a(n)) = n. - _Reinhard Zumkeller_, Dec 02 2014
%p A018252 with(numtheory); sort(convert(convert([ seq(i,i=1..541) ],set) minus convert([ seq(ithprime(i),i=1..100) ],set),list));
%p A018252 seq(`if`(not isprime(n),n,NULL),n=1..88); # _Peter Luschny_, Jul 29 2009
%p A018252 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
%t A018252 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 *)
%t A018252 max = 90; Complement[Range[max], Prime[Range[PrimePi[max]]]] (* _Harvey P. Dale_, Aug 12 2011 *)
%t A018252 Join[{1}, Select[Range[100], CompositeQ]] (* _Jean-François Alcover_, Nov 07 2021 *)
%o A018252 (Magma) [n : n in [1..100] | not IsPrime(n) ];
%o A018252 (PARI) isA018252(n) = !isprime(n)
%o A018252 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
%o A018252 (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)
%o A018252 (Sage)
%o A018252 def A018252_list(n) :
%o A018252     return [k for k in (1..n) if not k.is_prime()]
%o A018252 A018252_list(88)  # _Peter Luschny_, Feb 03 2012
%o A018252 (Haskell)
%o A018252 a018252 n = a018252_list !! (n-1)
%o A018252 a018252_list = filter ((== 0) . a010051) [1..]
%o A018252 -- _Reinhard Zumkeller_, Mar 31 2014
%o A018252 (GAP) A018252 := Difference([1..10^5], Filtered([1..10^5], IsPrime)); # _Muniru A Asiru_, Oct 21 2017
%o A018252 (Python)
%o A018252 from sympy import isprime
%o A018252 def ok(n): return not isprime(n)
%o A018252 print([k for k in range(1, 89) if ok(k)]) # _Michael S. Branicky_, Nov 10 2022
%o A018252 (Python)
%o A018252 from sympy import composite
%o A018252 def A018252(n): return 1 if n == 1 else composite(n-1) # _Chai Wah Wu_, Nov 15 2022
%Y A018252 Cf. A000040 (complement), A002808.
%Y A018252 Cf. A000005, A001222, A141468.
%Y A018252 Boustrophedon transforms: A230955, A230954.
%Y A018252 Cf. A010051, A239968.
%K A018252 nonn,nice,easy,core
%O A018252 1,2
%A A018252 _N. J. A. Sloane_