login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A081676 Largest perfect power <= n. 2

%I #31 Mar 08 2020 11:08:06

%S 1,1,1,4,4,4,4,8,9,9,9,9,9,9,9,16,16,16,16,16,16,16,16,16,25,25,27,27,

%T 27,27,27,32,32,32,32,36,36,36,36,36,36,36,36,36,36,36,36,36,49,49,49,

%U 49,49,49,49,49,49,49,49,49,49,49,49,64,64,64,64,64,64,64,64,64,64,64

%N Largest perfect power <= n.

%C a(n) = n if n is in A001597, otherwise a(n) = a(n-1). - _Robert Israel_, Dec 17 2015

%H Neven Sajko, <a href="/A081676/b081676.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = n - A069584(n).

%p N:= 1000: # to get a(1) to a(N).

%p Powers:= {1,seq(seq(b^p, p=2..floor(log[b](N))),b=2..isqrt(N))}:

%p Powers:= sort(convert(Powers,list)):

%p j:= 1:

%p for i from 1 to N do

%p if i >= Powers[j+1] then j:= j+1 fi;

%p A[i]:= Powers[j];

%p od:

%p seq(A[i],i=1..N); # _Robert Israel_, Dec 17 2015

%t Array[SelectFirst[Range[#, 1, -1], Or[And[! PrimeQ@ #, GCD @@ FactorInteger[#][[All, -1]] > 1], # == 1] &] &, 72] (* _Michael De Vlieger_, Jun 14 2017 *)

%o (PARI) a(n) = {while(!ispower(n), n--; if (n==0, return (1))); n;} \\ _Michel Marcus_, Nov 04 2015

%o (Sage)

%o p = [i for i in (1..81) if i.is_perfect_power()]

%o r = [[p[i]]*(p[i+1]-p[i]) for i in (0..10)]

%o print([y for x in r for y in x]) # _Peter Luschny_, Jun 13 2017

%Y Cf. A001597, A069584.

%K nonn

%O 1,4

%A _Reinhard Zumkeller_, Mar 26 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)