Ruud H.G. van Tol on Wed, 16 Nov 2022 16:22:16 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: A306044(n)
- From: "Ruud H.G. van Tol" <ruud.vantol@booking.com>
- Date: Wed, 16 Nov 2022 16:21:10 +0100
- Delivery-date: Wed, 16 Nov 2022 16:22:16 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=booking.com; h=message-id : date : mime-version : to : from : subject : content-type : content-transfer-encoding; s=pp; bh=uJmCN3vT/Az0kWacaTANnuwG7kX2HH53M2lcnwtPolg=; b=aBIU+U2usUP7tiaGvSaMLNWpJh5hFQ3uRvVZOQwV/jWMhJRuGxvs4kYOSiev89r1zbOU fzjGsGnSCw9AEkMPCtyLzweR6NdnSTTiOd4CX41cZF47IGUb2pdAGTOLF6QOdLVRKi27 L1fZbdHFqOLlvkUGvcpTc+WRS1kQU+dUUmb8OsAcKZV45Zk1+mBaXukmTIJf/igH0XhZ Di/fmP4GugcnPKYqzWt0E8KbjgLMWhltSxkSMmdfglNzeNC2lEH9h3y5Knqu9BfYwyRs pozjl/U7GThcyA7Pe9AZQIoPphmwzjlxcq4A0ADokBd6fqCZHskweeBrEGgbLL2SshTk 5w==
- Organization: Booking.com
- User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.2
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.
In case it overshoots, there is a backtracking p-- later.
Please let me know if there is a better way to initialize 'p'.
Or a better way to do all of this together!
-- Thanks, Ruud
- Follow-Ups:
- Re: A306044(n)
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>