Ruud H.G. van Tol on Sun, 20 Nov 2022 11:22:47 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: A306044(n) |
On 2022-11-17 02:10, Ruud H.G. van Tol wrote:
On 2022-11-16 23:39, Ruud H.G. van Tol wrote: Revised code:
Cleaned it up a bit further: { A306044(n, f= primes(3))= my(q= sum(k=1, #f, 1/log(f[k]))); for ( i= 1, #f , my( p= logint(exp(n/q), f[i]), d=0, j=0, m=0); while ( j < n , m= f[i]^(p+d); j= 1 + sum(k=1, #f, logint(m, f[k])); if(j==n, return(m)); d++ ) ); error("huh?") /* - Best if /f/ is an ordered set of coprimes. - Observation: with f = primes(P), d <= logint(P, 2). */ } Example run: ? [ a306044(n,[3,4]) |n<-[1..15] ] [1, 3, 4, 9, 16, 27, 64, 81, 243, 256, 729, 1024, 2187, 4096, 6561] -- Ruud