[Commit] nickle/examples google-puzzle.5c,1.2,1.3
Bart Massey
commit at keithp.com
Thu Sep 16 23:57:26 PDT 2004
Committed by: bart
Update of /local/src/CVS/nickle/examples
In directory home.keithp.com:/tmp/cvs-serv12410
Modified Files:
google-puzzle.5c
Log Message:
Fixed to return proper answer :-). Learned a lot about
Nickle on this one :-) :-).
Index: google-puzzle.5c
===================================================================
RCS file: /local/src/CVS/nickle/examples/google-puzzle.5c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- google-puzzle.5c 17 Sep 2004 01:16:05 -0000 1.2
+++ google-puzzle.5c 17 Sep 2004 06:57:24 -0000 1.3
@@ -213,12 +213,12 @@
autoimport MillerRabin;
-while (length(edigits) >= 10) {
+while (length(edigits) > 10) {
string nextdigits = substr(edigits, 0, 10);
if (!MillerRabin::composite(atoi(nextdigits, 10), 256)) {
- printf("%s %d\n", nextdigits, atoi(nextdigits,10));
+ printf("%s\n", nextdigits);
exit(0);
}
- edigits = substr(edigits, 10, length(edigits) - 10);
+ edigits = substr(edigits, 1, length(edigits) - 1);
}
printf("no\n");
More information about the Commit
mailing list