Ruud H.G. van Tol on Thu, 17 Nov 2022 02:11:18 +0100


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

Re: A306044(n)



On 2022-11-16 23:39, Ruud H.G. van Tol wrote:

Revised code:

{
a(n, P= 3)=
my
( f= primes(P)
, q= vecsum([ 1/log(x) |x<-f])
);
for
( i= 1, #f
, my
  ( p= logint(exp(n/q), f[i])
  , d= -1, j= 0, m= 0
  );
  while
  ( j < n
  , d++;
    m= f[i] ^ (p+d);
    j= 1 + vecsum([ logint(m,x) |x<-f]);
    if( j == n, return(m) );
  );
);
}

And amazingly (to me) :
d never becomes > logint(P,2), so real nice!

I still expect there to be a more direct way possible,
but this is quite good already.

-- Ruud