P40 { public static int phi(int m) { return P33.primeFactorsMult(m) .stream() .map(entry -> (entry.getKey() - 1) * Math.pow(entry.getKey(), entry.getValue() - 1)) .mapToInt(Double::intValue) .reduce(1, (i1, i2) -> i1 * i2); }  static int phi(int m);  }
@Test public void phiOf10Is4() throws Exception { int p = P40.phi(10); assertThat(p, equalTo(4)); }
@Test public void phiOf99Is60() throws Exception { int p = P40.phi(99); assertThat(p, equalTo(60)); }