login
Zero together with the nonprime numbers A018252.
204

%I #52 Oct 12 2024 09:06:11

%S 0,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 36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56,57,58,60,62,63,64,65,

%U 66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88

%N Zero together with the nonprime numbers A018252.

%C 0 and 1 together with the composite numbers (A002808). - _Omar E. Pol_, Jul 04 2009

%H N. J. A. Sloane, <a href="/A141468/b141468.txt">Table of n, a(n) for n = 1..17739</a>

%F a(1) = 0; a(n) = A018252(n-1), n > 1. - _Omar E. Pol_, Aug 13 2009

%F a(n) = A018252(n) - A054546(n). - _Omar E. Pol_, Oct 21 2011

%F a(n) = A002808(n-2) for n > 2 . - _Robert G. Wilson v_, Jan 29 2015, corrected by _RĂ©mi Guillaume_, Aug 26 2024.

%p A141468 := proc(n) option remember; local a; if n <=2 then n-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_, Dec 13 2010

%t nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n + PrimePi@ n]; Array[ nonPrime, 66, 0] (* _Robert G. Wilson v_, Jan 29 2015 *)

%t Join[{0,1},Select[Range[100],CompositeQ]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Oct 22 2017 *)

%o (Haskell)

%o a141468 n = a141468_list !! (n-1)

%o a141468_list = 0 : a018252_list -- _Reinhard Zumkeller_, May 31 2013

%o (PARI) a(n) = my(k=0); n--; while(-n+n+=-k+k=primepi(n), ); n; \\ _Ruud H.G. van Tol_, Jul 15 2024

%o (PARI) list(lim)=if(lim<1, return(if(lim<0,[],[0]))); my(v=List([0,1])); forcomposite(n=4,lim\1, listput(v,n)); Vec(v) \\ _Charles R Greathouse IV_, Jul 15 2024

%o (Python)

%o from sympy import composite

%o def A141468(n): return n-1 if n < 3 else composite(n-2) # _Chai Wah Wu_, Oct 11 2024

%Y Cf. A018252, A002808, A054546 (first differences).

%K nonn

%O 1,3

%A _Juri-Stepan Gerasimov_, Aug 11 2008

%E Added 68 by _R. J. Mathar_, Aug 14 2008

%E Better definition from _Omar E. Pol_, Jun 30 2009