Ruud H.G. van Tol on Tue, 21 Dec 2021 11:32:02 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

simple benchmarking



? my(t0=getabstime()); for (n=1, 2^25-1, n-2^(#binary(n)-1)); printf("%.3fs",(getabstime()-t0)/1000)
14.434s

? my(t0=getabstime()); for (n=1, 2^25-1, n-2^logint(n,2)); printf("%.3fs",(getabstime()-t0)/1000)
10.600s

? my(t0=getabstime()); for (n=1, 2^25-1, n-2^exponent(n)); printf("%.3fs",(getabstime()-t0)/1000)
8.460s

See the PARI code in https://oeis.org/A053645

-- Ruud