luis . gallardo on Thu, 12 Jan 2023 12:32:18 +0100


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

Re: probable bug of "ispower" function in GP: FALSE, apologies!


Hi Bill,


Apologies!

I misunderstood the definition of "ispower"!


I wanted a function that identify directly if some integer is a power of 2


cordially,


luis
***



luis.gallardo@math.cnrs.fr a écrit :

Brest, January 12, 2023.

Hi Bill,

While working on a problem I landed at:

Reading GPRC: gprc.txt
GPRC Done.

GP/PARI CALCULATOR Version 2.15.0 (released) amd64 running mingw (x86-64/GMP-6.1.2 kernel) 64-bit version compiled: Sep 19 2022, gcc version 10-posix 20210110 (GCC) threading engine: single (readline v8.0 enabled, extended help enabled)

Copyright (C) 2000-2022 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?18 for how to get moral (and possibly technical) support.

parisize = 8000000, primelimit = 500000
(01:00) gp > ispower(8,2)
%1 = 0
(01:00) gp > ispower(16,2)
%2 = 1
(01:00) gp > ispower(9,3)
%3 = 0
(01:00) gp > ispower(27,3)
%4 = 1
(01:01) gp > ispower(4,2)
%5 = 1
(01:01) gp >


***
I checked other versions of GP, including a linux one:

same problem!

Cordially,

luis
***

Lis H. Gallardo


Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> a écrit :

On Sat, Oct 15, 2022 at 11:05:56AM +0200, luis.gallardo@math.cnrs.fr wrote:
Hi,

Nice new version!

What about to add some basic versions of sum and prod?

sum by steps

prod by steps

Hi Luis,

Could you give an example ?

Thanks for using PARI/GP!
Bill.