## [Audacity-nyquist] Number theory with Nyquist.

 [Audacity-nyquist] Number theory with Nyquist. From: paul beach - 2010-06-24 19:49:27 ```Rem seems to be more general than mod. Should be useful for multiple congruences,(the so-called Chinese remainder theory). Also there is a (gcd a b), meaning greatest common divisor. Even though there is no MOD statement, LISP seems to be superior with respect to NUMBER theory. Some topics would be, primitive roots, quadratic residues, congruence. Just checking that (rem a b) is the same as modulus: Nyquist prompt: (rem 22 5) ; == 22 mod 5 Output =2 Much better than this, (- 22 (* 5 (/ 22 5))) ; no error checking! Thank you very much. On Thu, 24 Jun 2010 20:21:54 +0200, "edgar" said: > paul beach asked: > > > I don't see a mod function in the documentation; and presume > > it would be done like this: > > > > ; mod ( n, d ) = n - d * int (n/d) > > > > ; 22 mod 5 = 2 > > > > (- 22 (* 5 (/ 22 5))) > > Output 2 > > I have no particular knowledge how it works in SAL, > but XLISP has a REM function, see: > > http://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-217.htm > > If you see in XLISP: > > (rem expr1 expr2 ...) > > then this should work in SAL like this: > > rem(expr1, expr2, ...) > > I know that REM is not 100% equal to MOD but as far > as I know there is no MOD function in XLISP or SAL. > > - edgar > > > > > > > > > -- > The author of this email does not necessarily endorse the following > advertisements, which are the sole responsibility of the advertiser: > > > ------------------------------------------------------------------------------ > ThinkGeek and WIRED's GeekDad team up for the Ultimate > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the > lucky parental unit. See the prize list and enter to win: > http://p.sf.net/sfu/thinkgeek-promo > _______________________________________________ > Audacity-nyquist mailing list > Audacity-nyquist@... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist -- paul beach sniffyraven@... ```