Ruud H.G. van Tol on Wed, 16 Nov 2022 23:40:53 +0100


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

Re: A306044(n)



On 2022-11-16 16:56, Bill Allombert wrote:
On Wed, Nov 16, 2022 at 04:21:10PM +0100, Ruud H.G. van Tol wrote:

I added PARI-code to https://oeis.org/A306044
"Powers of 2, 3 and 5."
but I'm not happy with it.

{
a(n)=
my(f= [2, 3, 5]);  /* ordered co-primes (?) */
for(i= 1, #f
, my(p= (n-1)\f[i], d= -1, j= 0, m= 0);
   while( j < n
   , d++;
     m= f[i] ^ (p+d);
     j= 1; for(k=1, #f, j+= logint(m, f[k])); /* j= index */
     if( (j > n) && 0 == d, j=0; p--; d=-1) /* retry */
   );
   if(j==n, return(m))  /* found */
)
}

The initial value of 'p' is a (simple) guess.

Seems to me you want to invert
b(n)=logint(n,2)+logint(n,3)+logint(n,5)+1;

an approximation is thus
h(n)=exp((n-1)/(1/log(2)+1/log(3)+1/log(5)))

This function is a good approximation of a(n):
g(n)=my(f=[2,3,5],e,a=round(exp((n+1)/(1/log(2)+1/log(3)+1/log(5))),&e));vecmax([p^logint(a,p)|p<-f]);

Thanks!

I used it for a better guess:
p= logint(exp((n+1)/(1/log(2)+1/log(3)+1/log(5))),f[i])

That already leads to much less steps per call.

And I'm now investigating how to remove the backtracking.
(IOW: check if it indeed doesn't overshoot anymore)

-- Ruud