OFFSET
1,3
COMMENTS
a(n) = A031218(n-1) for all n where 2 <= n <= 33.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
The largest prime power that is <= 34 is 32 = 2^5. But 32 is not coprime to 34. The next smaller prime power is 31 = 31^1. 31 is indeed coprime to 34; so a(34) = 31.
MAPLE
f:= proc(n) local k;
for k from n by -1 do
if igcd(k, n)=1 and nops(numtheory:-factorset(k))<=1 then return k fi
od
end proc:
map(f, [$1..100]); # Robert Israel, Jan 17 2018
MATHEMATICA
a[n_] := For[k = n, True, k--, If[CoprimeQ[n, k] && PrimeNu[k] == 1, Return[k]]]; a[1] = a[2] = 1;
Array[a, 100] (* Jean-François Alcover, Aug 19 2020 *)
PROG
(PARI) a(n) = {my(x=n); while((matsize(factor(x))[1]>1) || (gcd(x, n)!=1), x--); x} \\ Michael B. Porter, Oct 07 2009
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Apr 14 2008
EXTENSIONS
More terms from Michael B. Porter, Oct 07 2009
STATUS
approved