August 27, 2024
P31 - Determine whether a given integer number is prime.
Arithmetic
For the next section, we’re going to take a different tack with the solutions. We’ll declare a new class, S99Int, and an implicit conversion from regular Ints. The arithmetic1 file contains the starting definitions for this section. Each individual solution will show the relevant additions to the S99Int class. The full class will be given at the end of the section.
scala
scala> 7.isPrime
res0: Boolean = true