OFFSET
1,4
LINKS
Robert Price, Table of n, a(n) for n = 1..2000
EXAMPLE
For a(14), 10, 12, and 14 are not prime powers, and 11 and 13 are prime powers but they are prime. Since 9 = 3^3 is a prime power, a(14) = 9.
MATHEMATICA
Array[SelectFirst[Range[#, 1, -1], Or[And[! PrimeQ@ #, PrimePowerQ@ #], # == 1] &] &, 74] (* Michael De Vlieger, Jun 14 2017 *)
PROG
(PARI) isA025475(n) = (omega(n) == 1 & !isprime(n)) || (n == 1)
A167185(n) = {local(m); m=n; while(!isA025475(m), m--); m}
(Sage)
p = [n for n in (1..81) if (is_prime_power(n) or n == 1) and not is_prime(n)]
r = [[p[i]]*(p[i+1] - p[i]) for i in (0..9)]
print([y for x in r for y in x]) # Peter Luschny, Jun 14 2017
(Python)
from sympy import factorint
def A167185(n): return next(filter(lambda m:len(f:=factorint(m))<=1 and max(f.values(), default=2)>1, range(n, 0, -1))) # Chai Wah Wu, Oct 25 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michael B. Porter, Oct 29 2009
STATUS
approved