Hi John,
In the mean time -- from a few days ago , should work also in TinyScheme (with minor modifications) , code finds a number exact ! solutions of the Riemann Zeta function , it's based on recognizing number patterns. ( I hope it's correct , otherwise I'll get a number of mathematicians against me
-- should be an excellent benchmark
--------------------------------------------
(define zeta (λ (lim n acc)
(if (zero? lim) acc
(zeta (- lim 1) n (+ acc (/ 1.0 (expt lim n)))))))
(define pi-list (λ (n L)
(if (zero? n) L
(pi-list (- n 1) (cons (expt pi n) L)))))
(define almost (λ (x )
(let (( tst (round x)))
(if (< (abs (- x tst)) 0.00001) (round x) 0)
)))
(define not-zero? (λ (i max L)
(if (or (= i (- max 1) ) (> (car L) 0)) (list i (car L))
(not-zero? (+ i 1) max (cdr L)))))
(define iter
(let (( piL (pi-list 20 '())) (res '()) (solution 0) )
{λ (start end)
(if (= start end) (display "finished")
(begin
(let (( x (zeta 1000000 start 0 )))
(set! res (map (lambda (y) (/ y x)) piL))
(set! res (map almost res))
(set! solution (not-zero? 0 (length res) res))
(when (> (cadr solution) 0)
(display "Zeta(")
(display start) (display ") = expt pi ")
(display (+ 1 (car solution)))
(display " / ")
(displayln (cadr solution)) ))
(iter (+ 1 start) end )))}))
(define main (λ ()
(displayln "Zeta solutions")
(displayln "--------------")
(displayln " ")
(iter 2 12)))
(main)
---------------- you will have to replace the λ by lambda and define (define (displayln s) (display s) (newline))
You can compare the speed with compiled (bytecode and GNU Lightning JIT) pro attachment
best Rob
(I wrote the code in a way it is compatible with BL too -- begin replaced with sequence and display to be replaced with print...
)
sorry , lisp .. means big executables..... pi should be defined in TS I think ?
.