Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

implementing successive squaring algorithm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23218] implementing successive squaring algorithm
  • From: "Matthew Herman" <Henayni at hotmail.com>
  • Date: Mon, 24 Apr 2000 01:12:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I was looking to implement the successive squaring algorithm (same as 
PowerMod), and I seem to have it, but the program won't store the 
modulus value.
I took apart the program to the base of the problem, if anyone has 
suggestions let me know.

pmod[a_,b_,m_]:=g[a,IntegerDigits[b,2],m];
g[a_,blist_,m_]:=blist*Reverse[NestList[f,a,(Length[blist]-1)]];
f[a_] := Mod[a^2, m]

What happens is that I get the NestList with it not being evaluated for 
m=modulus.

Thanks

matt


  • Prev by Date: sound files...
  • Next by Date: copying notebook sections to text documents
  • Previous by thread: Re: sound files...
  • Next by thread: Re: implementing successive squaring algorithm