Declan

20 Reputation

4 Badges

9 years, 117 days

MaplePrimes Activity


These are questions asked by Declan

I'm trying to write a procedure that computes Pollard's P-1 Method for a given integer n, and then outputs the prime factorisation of n.

Here is what I have so far:

Pollard := proc (n)
local i, r, g;
r[1] := `mod`(2^factorial(2), n);
for i from 2 while gcd(`mod`(r[i-1]-1, n), n) = 1 do
r[i] := `mod`(2^factorial(i+1), n) end do;
g[i] := gcd(`mod`(r[i-1]-1, n), n);
if g[i] < n then return g[i]
else return n
end if
end proc;

But my procedure doesn't seem to work for a lot of large values for n.
And also I can't figure out how to make it actually output the factorisation.

Any help would be appreciated.

Is there a way in Maple to convert a list into a string of numbers?

So [1,2,3,4,5] -> 12345

I have tried Maple help, but there are too many convert commands to try them all.
And the ones I have tried didn't work.

Thanks.

Hi,

I'm trying to fill an Array but I don't know the correct syntax, and Maple help isn't much use.

How do I form an Array, A, which has 10 rows and 2 columns. Where one column is say the row number squared and the other column is the row number cubed. 

So A would be:

[1 1]
[4 8]
[9 27] .....

Also, I'm using the square and cube numbers as an example. But is there a general format for doing this, whatever the values I want to put in the array are?

Thanks

 

Think I've solved my problems, thanks.

Hi, I'm having trouble with print doing strange things:


a:=1235
                1235

b:=751
                751


p:=1601
                1601



print(The solution `to` a^x = b (`mod ` p) is x = 1323)

                              1601 The solution to (1235^x) = 751 mod is x = 1323


Why has the 1601 gone to the beginning, and how do I make it go to the correct place?

Also is it possible to remove the brackets from around 1235^x?

And is it possible to make the brackets (that I have put in) go around the `mod` p?

EDIT:

If I do: print(The solution `to` a^x = b (`mod ` ,p) is x = 1323)

I get:  The solution to (1235^x) = 751 (mod, 1601) is x = 1323

So is there a way to just remove the comma on the output?


Thanks.

1 2 Page 1 of 2