A179278 Largest nonprime integer <= n.
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
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.
A095195 has row n equal to the k-th differences of the prime numbers.
A113646 gives least nonprime >= n.
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 > 0: a(n) = A113638(n). - Georg Fischer, Oct 12 2018
Extensions
Inequality in the name reversed by Gus Wiseman, Dec 05 2024