Check scripts for calculation errors.
This commit is contained in:
parent
996a54279c
commit
c37a2cc886
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
const target = 30;
|
const target = 30;
|
||||||
|
|
||||||
let now = timestamp();
|
|
||||||
|
|
||||||
fn fib(n) {
|
fn fib(n) {
|
||||||
if n < 2 {
|
if n < 2 {
|
||||||
n
|
n
|
||||||
@ -15,8 +13,14 @@ fn fib(n) {
|
|||||||
|
|
||||||
print("Ready... Go!");
|
print("Ready... Go!");
|
||||||
|
|
||||||
|
let now = timestamp();
|
||||||
|
|
||||||
let result = fib(target);
|
let result = fib(target);
|
||||||
|
|
||||||
|
print("Finished. Run time = " + now.elapsed() + " seconds.");
|
||||||
|
|
||||||
print("Fibonacci number #" + target + " = " + result);
|
print("Fibonacci number #" + target + " = " + result);
|
||||||
|
|
||||||
print("Finished. Run time = " + now.elapsed() + " seconds.");
|
if result != 832_040 {
|
||||||
|
print("The answer is WRONG! Should be 832,040!");
|
||||||
|
}
|
@ -27,3 +27,7 @@ for p in range(2, MAX_NUMBER_TO_CHECK) {
|
|||||||
|
|
||||||
print("Total " + total_primes_found + " primes <= " + MAX_NUMBER_TO_CHECK);
|
print("Total " + total_primes_found + " primes <= " + MAX_NUMBER_TO_CHECK);
|
||||||
print("Run time = " + now.elapsed() + " seconds.");
|
print("Run time = " + now.elapsed() + " seconds.");
|
||||||
|
|
||||||
|
if total_primes_found != 9_592 {
|
||||||
|
print("The answer is WRONG! Should be 9,592!");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user