P38

ninetynine.P38
object P38

P38 - Compare the two methods of calculating Euler's totient function.

Use the solutions of problems P34 and P37 to compare the algorithms. Try to calculate phi(10090) as an example.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
P38.type

Members list

Value members

Concrete methods

def compareTotient(n: Int): ((Int, Long), (Int, Long))

Compare the performance of the two totient functions and return results

Compare the performance of the two totient functions and return results

Value parameters

n

the number to calculate the totient for

Attributes

Returns

a tuple containing both results and their execution times in nanoseconds

def speedup(n: Int): Double

Calculate how much faster the P37 implementation is compared to P34

Calculate how much faster the P37 implementation is compared to P34

Value parameters

n

the number to calculate the totient for

Attributes

Returns

the speedup factor (P34 time / P37 time)

Concrete fields

val logger: Logger