View Single Post
Old 2020-02-14, 09:12   #4
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

22×7×317 Posts
Default

Code:
gp > cnt=0;for(i=1,100000,if(ispower(i),print(cnt++": "i)))
.....

<lot of lines removed>
....

359: 96721
360: 97336
361: 97344
362: 97969
363: 98596
364: 99225
365: 99856
366: 100000
gp > getnum(n)=s=0;for(i=2,log(n)/log(2),z=floor(n^(1/i)); s+=z-getnum(z)-1);s
%2 = (n)->s=0;for(i=2,log(n)/log(2),z=floor(n^(1/i));s+=z-getnum(z)-1);s
gp > getnum(10)
%3 = 3
gp > getnum(16)
%4 = 4
gp > getnum(10000)
%5 = 124
gp > ##
  ***   last result computed in 0 ms.
gp > getnum(100000)
%6 = 366
gp > ##
  ***   last result computed in 0 ms.
gp > getnum(10^50)
time = 15 ms.
%7 = 10000000046415898134516526
gp > ##
  ***   last result computed in 15 ms.
gp >
(it seems like my boss is not pushing me too hard today... )

Last fiddled with by LaurV on 2020-02-14 at 09:13
LaurV is offline   Reply With Quote