Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #46272 > unrolled thread
| Started by | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| First post | 2016-03-29 05:10 +0000 |
| Last post | 2016-03-28 23:58 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.forth
Rosetta: Lucas-Lehmer test "WJ" <w_a_x_man@yahoo.com> - 2016-03-29 05:10 +0000
Re: Rosetta: Lucas-Lehmer test Paul Rubin <no.email@nospam.invalid> - 2016-03-28 23:58 -0700
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Date | 2016-03-29 05:10 +0000 |
| Subject | Rosetta: Lucas-Lehmer test |
| Message-ID | <ndd2nk$3lt$1@dont-email.me> |
Ocaml (based on the ingenious Pascal solution):
#load "nums.cma" ;;
open Num ;;
let n = ref (Int 1) in
for exponent = 2 to 2500 do
let s = ref (Int (if exponent=2 then 0 else 4)) in
n := pred_num ((succ_num !n) */ Int 2) ;
for i = 1 to exponent - 2 do
s := mod_num (!s */ !s -/ Int 2) !n
done ;
if !s = Int 0 then
Printf.printf "%d %!" exponent
done ;;
===>
2 3 5 7 13 17 19 31 61 89 107 127 521 607 1279 2203 2281
Is it wise to try this in ANS Forth?
--
[T]he number of Jews killed there was 800,000,000.... [T]he Talmud makes it all
clear by informing us that the blood of the holocausted Jews ran to the sea in
a huge tidal wave that swept boulders in its path and was so deep that it
reached the nostrils of the Romans' horses.
nationalvanguard.org/2014/09/disillusioned-part-1/
[toc] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-03-28 23:58 -0700 |
| Message-ID | <874mbp6a8u.fsf@nightsong.com> |
| In reply to | #46272 |
"WJ" <w_a_x_man@yahoo.com> writes:
> let n = ref (Int 1) in
> for exponent = 2 to 2500 do
> let s = ref (Int (if exponent=2 then 0 else 4)) in
> n := pred_num ((succ_num !n) */ Int 2) ;...
Carl Ludwig Siegel wrote in 1964:
The whole style of the author contradicts the sense for simplicity
and honesty which we admire in the works of the masters in number
theory - Lagrange, Gauss, or on a smaller scale, Hardy, Landau. Just
now Lang has published another book on algebraic numbers which, in
my opinion, is still worse than the former one. I see a pig broken
into a beautiful garden and rooting up all flowers and trees.
He might have been writing about WJ's O'Caml code.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.forth
csiph-web