Talk:Multiplicative order

From Rosetta Code
Revision as of 15:28, 8 December 2007 by rosettacode>Roger Hui (→‎Clarification: response)

Clarification

There's more than one way to determine the multiplicative order. While my J is next to non-existant, I can tell you're not using one of the naive ones :-) As the point of Rosetta is to compare equal algorithms in different languages (and not different algorithms in different languages), please state in the task which algorithm you'd like to be used. Also, IMHO the tasks should be chosen to allow a meaningful comparison of languages, and I am not sure if this is a good task for this purpose, because it's more centered on the algorithm than on the possible different ways different languages work. Dirkt 03:57, 8 December 2007 (MST)

  • The J solution implements the algorithm described in Bach & Shallit, Algorithmic Number Theory I, exercise 5.8, page 118.
    Judging by the other programming tasks, the submissions in the various languages don't always implement the same algorithm, but use algorithms that are "natural" to the language. That too is a meaningful comparison. Roger Hui 08:28, 8 December 2007 (MST)

Java solution

There is currently a mismatched left paren in the line:

for(;x.modPow(retVal, y) != BigInteger.ONE;retVal = retVal.add(BigInteger.ONE);

Roger Hui 21:27, 7 December 2007 (MST)