OFFSET
2,1
COMMENTS
For n odd, a(n) is the greatest prime <= n; for n even > 2, a(n) is the greatest prime < n-1.
For composite n = p + 1, p does not appear since 2 is the smallest prime. - Michael De Vlieger, May 31 2020
LINKS
Michael De Vlieger, Table of n, a(n) for n = 2..10000
Michael De Vlieger, Plot of greatest primes of prime partitions of n for 2 <= n <= 41; this sequence is the greatest prime shown in each row of the diagram.
EXAMPLE
a(9) = 7, the greatest prime < 9 (prime partitions of 9 are: [2,7], [2,2,5], [2,2,2,3] and [3,3,3], in which 7 is greatest of greatest parts).
a(12) = 7 (greatest prime < 11).
MATHEMATICA
Array[Max@ Select[IntegerPartitions[#], AllTrue[#, PrimeQ] &][[All, 1]] &, 68, 2] (* Michael De Vlieger, May 30 2020 *)
Array[Prime[PrimePi@ # - Boole[And[PrimeQ[# - 1], # != 3]]] &, 68, 2] (* Michael De Vlieger, May 31 2020 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Michael De Vlieger May 30 2020
STATUS
approved