Skip to content

fixes #973 #1045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions xml/chapter1/section2/subsection6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -657,12 +657,13 @@ function timed_prime_test(n) {
function start_prime_test(n, start_time) {
return is_prime(n)
? report_prime(get_time() - start_time)
: true;
: false;
}
<SHORT_SPACE_AND_ALLOW_BREAK/>
function report_prime(elapsed_time) {
display(" *** ");
display(elapsed_time);
return true;
}
</JAVASCRIPT>
</SNIPPET>
Expand Down Expand Up @@ -726,8 +727,8 @@ function search_for_primes(start, times) {
? true
: start &gt; 2 &amp;&amp; start % 2 === 0
? search_for_primes(start + 1, times)
// if we get undefined -&gt; its a prime
: is_undefined(timed_prime_test(start))
// if we get true, it's a prime
: timed_prime_test(start)
? search_for_primes(start + 2, times - 1)
: search_for_primes(start + 2, times);
}
Expand All @@ -740,8 +741,8 @@ function search_for_primes(start, times) {
<REQUIRES>search_for_primes_definition</REQUIRES>
<JAVASCRIPT>
search_for_primes(10000, 3);
// search_for_primes(100000, 3);
// search_for_primes(1000000, 3);
// search_for_primes(10000000, 3);
// search_for_primes(10000000000, 3);
</JAVASCRIPT>
<SCHEME>
</SCHEME>
Expand Down
Loading