> < ^ Date: Tue, 11 Nov 2003 16:31:15 +0100
< ^ From: Stefan Kohl <kohl@mathematik.uni-stuttgart.de >
> < ^ Subject: Re: Power of a specific Prime!

Dear Forum,

saad bedaiwi wrote:

Let L be a list of integers, is there a way to test whether each member of L
is a power of a
specific prime, it seems that the command "IsPrimePowerInt" do
that but for an arbitrary prime

Yes, you can do the following:

Define a function ...

OnlyPowersOfp := function ( L, p )
  return ForAll( L, n -> SmallestRootInt( n ) = p );

... which does what you want, e.g.:

gap> OnlyPowersOfp([8,32,128,1048576],2);
gap> OnlyPowersOfp([8,32,128,1048576],3);
gap> OnlyPowersOfp([8,9,128,1048576],2);

If you have further questions about this I think that the gap-trouble list
is probably a better place for discussing these than the whole forum.

Hope this helps,

Stefan Kohl

> < [top]