Karim Belabas on Wed, 28 Dec 2022 17:52:45 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: "Ruud H.G. van Tol" <rvtol@isolution.nl>
- Subject: Re: A022921-code
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Wed, 28 Dec 2022 17:51:34 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1672246294; c=relaxed/relaxed; bh=Q26H/8kZ803nMKAUXIoCzSlziO8oEZYYTPuTATQKvkU=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=rnxYfsvm9glwELh9l6JkcFMwCUVEz1qwFCcWaA5wyoMP4q00/RmHebtxMBVDNgZJJe5UWdZUJL992TCC7COIRKQFba25YcM+1LypRTVwGaB272uVQYP1/QEj5Rb/2Xnk8uQsbIHZvWtdPeFeP6mQfbp7wH/4Y3vVdUvFgC28+sVHNlY3E+TkZZVi/La8ZJ15kdAMEIjpBo0WMr2ZwMJagmmicw5tPDnW3YtctiNYzMVGpcTKHrmsRgnXhZ2/0QXLnWU4XniG61zNB9VO1+9ahJjVIrtqKt602MkoZV+SCmE7cQf86eQuZOvsNPO8iLgyRSWnNPyI2ip1QcwFq3nxgo5OTDLsk5EwW0f2DIYpvOCeI2oogMgncWnlL0wL/kzd4bn9L9vlrcZX3qGPBapBUy45jcUEPSmVoNAznJsC+Eh9CSxCxk0eSEsoUohRljNJ3Re7JPHrVlI6qifmmsQ88kieylpp4HY6Bie3JlEjEXgZpdwzY5sGjurBJDBWy/i7pMo9WGYGhad5rTbGXzzQ5flnO7G5KHyIltY9cJzDds113NKYZYfzU9O83WqT9bwazQ0hRcebAlrZIRxZh4msZUoQ+pRG4IMZXfd2egC1uE9WiOHMiaqezeFpBTgdRNuf8hdcby/ChvhNA6LSZ0WnS6FRqGbIqbU0rwy7YWyKBz8=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1672246294; cv=none; b=vlWVevvkseIthnfLaXo5dCoqXlYJtebBRA83zpyRjVdtRR//Bq6opT1GgXpCw/hjG1vEEtmK2Q+hUKUEdIcMWS55gnL7HpWskXcKEGhtuA2LCankh5TNrYZ3slS751BGmWL8LivaUOPMRd/0bCIo05xkQ2RX7yM/AmtcKDDiRoY1aPRbTGKWPjcZLFJzZHlLpRm1R7CQ2AMFp81YXkpd7WMvULITcPIBmYowkd9LPWDueRa2ofeVy9DOuMtFRDUS9Uh5XigxHQq+X+MkwGy4IufSlQub1FDusKpvVBxa+ocSBMmMI53X0rlwRaMcWhKb5fvnEnNcF1WPdja9snJRukf5n6cEKuuD6F9Vnd22qcRjrd02BklRU8FOmk06SosWG/qKKhOLwEYMjGKl5uVqfmLj5K6AAnUZVYYKW+ChJIhuiZqqKdB1amj2VY6e8TTMYWzCAgYHPdeHoRAOkoIwj2xicVIsuO/KMiYMO7Z2o+m5xDKBZ8kE95JhWehlgtC211YPyiXNsGx4NDKYSL5K6jsbuGFjVIoUESBesd5fvsjXklzPjb/jkFm8CigdBEBT92Qhk6lCjihTMFyeZ235voswu8lDBYULh+CZJaH6EnlMQRgcGAA1v63KOQmNBkHkDqq5Vhp5cDcb38DJH8bClwD2I8svJLsorAFV2BD0wSY=
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Wed, 28 Dec 2022 17:52:45 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1672246294; bh=Q26H/8kZ803nMKAUXIoCzSlziO8oEZYYTPuTATQKvkU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oYEaslZMZxQH9jdOchSrEesd6HGi0r06f4b2ETnbmCXHb+3b2vD6BY3SjpLy8qo1A k7iyTQK5kxL6jGWXQTFiHRHj5fdkPgzRSFdDeHZLJoTSPhbsz60/pNCB+8FWt5TGAz fOxmK39jOSSvhXpEbyxNr8f9EpejXn5tuo9/I+JgWHkdzr2c8WJoxd8fIjdZjUt2Uj rY9s+Rkw1RLPGxLqLPsg7CWINCrT7zTu/1yXIs8T+1yyqjhIDHi7Lc6QXtQefiMWFL o83w5Rjep0J7TVjuii0FAkWd2e115NBpuP1Zt1Uz6b5QqbRCjw/cC7UJ9WNWwg0lWF S3ON0jnD2IK79KRZwqcTHXXJg+X3FikA1yqMKcARfJDeirnr5Zp77zN5zHvQCtlsGM pF9WahMmrLwrHSckSMD///9cAEhI+CjmBeAbc1d/X8Wc7CI4mIyAEqIAANJ3Az1DAG cu9WhJmRMCpBG6tULNv+iHzSxih+adGgEYz/IzPhSeqYzInCdT6lMX4MGAHwFEA84c Sb+71o8Qw3Y9JKQyVOBaux2snkU2cu3pd0gZTBNq/JAfzDxId2Abg9ZEnbgOCmjFOg rk7NnbWeezYEZL8HVkhs/7xD9SDEupBXHZDjnZjrG4ChbqcPsUBY6RMQysIXDpgXXk g4/3u41a0I1Ztgy/RU0v/j2Q=
- In-reply-to: <22f99a3f-71e6-40b4-2fe2-4976ce949665@isolution.nl>
- Mail-followup-to: "Ruud H.G. van Tol" <rvtol@isolution.nl>, pari-users@pari.math.u-bordeaux.fr
- References: <22f99a3f-71e6-40b4-2fe2-4976ce949665@isolution.nl>
* Ruud H.G. van Tol [2022-12-28 16:28]:
>
> [ logint(3^(n+1),2) - logint(3^n,2) |n<-[0..98]]
>
> is half as fast as
>
>
>
> but IMO looks ugly.
>
> Is there a both "nice" and fast way to do similar?
Not sure about "nice"; but faster, definitely:
? N = 30000;
? w0 = [logint(3^(n+1),2) - logint(3^n,2) | n<-[0..N]];
time = 767 ms.
? my(n0=logint(3^0,2)); w1 = [-n0 + n0=logint(3^(n+1),2) |n<-[0..N]];
time = 355 ms.
? my(v = [logint(x,2) | x <-powers(3, N+1)]); w = vector(#v-1, i, v[i+1]-v[i]);
time = 20 ms.
? [w == w0, w == w1]
%4 = [1, 1]
Cheers,
K.B.
--
Karim Belabas / U. Bordeaux, vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/
`