Skip to content

Withholding information at Chapter 1, Exercise 1.22 #973

@cgbarros

Description

@cgbarros

The solution for exercise 1.22 assumes a function is_undefined that was not presented before in the text. We should either change the initial statement (or add a footnote) explaining that we should assume this function exists or we should change the solution. We can interpret the phrase

write a function search_for_primes that checks the primality of consecutive odd integers in a specified range

to be a function where you input the start and end of a range and it outputs the timed primality tests of all primes in that range. Something like

function search_for_primes(start, end) {
    timed_prime_test(start);
    return start % 2 === 0
        ? search_for_primes(start + 1, end)
        : start > end
            ? true
            : search_for_primes(start + 2, end);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions