Forum archive 2000-2006

Mark Schmitt - Number Theoretic Functions

Mark Schmitt - Number Theoretic Functions

by Arnold Pizer -
Number of replies: 0
inactiveTopicNumber Theoretic Functions topic started 8/13/2001; 10:09:24 AM
last post 8/15/2001; 8:50:23 AM
userMark Schmitt - Number Theoretic Functions  blueArrow
8/13/2001; 10:09:24 AM (reads: 1491, responses: 3)
Has anyone written routines to calculate GCD, LCM, a Mod b, a | b, etc? If so, could you post the code?

If not, I'll try to code them later this week. I need them to make a few factoring problems work. Thanks.

Mark

<| Post or View Comments |>


userMark Schmitt - Re: Number Theoretic Functions  blueArrow
8/14/2001; 7:01:02 PM (reads: 1776, responses: 0)
A follow-up to help anyone with a similar question. I've found that perl calculates a mod b using the code "$A % $B". I also found that somewhere in WeBWorK, gcd is defined. Is there a concise list of functions that are available to use as programmers somewhere?

Mark

<| Post or View Comments |>


userThomas R. Shemanske - Re: Number Theoretic Functions  blueArrow
8/15/2001; 8:43:52 AM (reads: 1787, responses: 0)
Some of these are in PGauxiliaryFunctions.pl.

Another possible source is that of Perl builtins, for example see

http://www.perldoc.com/perl5.6/pod/perlfunc.html

Cheers,

Tom

<| Post or View Comments |>


userThomas R. Shemanske - Re: Number Theoretic Functions  blueArrow
8/15/2001; 8:50:23 AM (reads: 1754, responses: 0)
Also, I found this piece of code in a sample problem, suggesting perl's a%b doesn't work well.

sub mod { # for some reason perl's % doesn't seem to work for large numbers?

my $a = shift;

my $b = shift;

$a - int($a/$b)*$b;

}

<| Post or View Comments |>