/Factorial_Java_Pekko

example exercise for actors in Apache Pekko

Primary LanguageJavaApache License 2.0Apache-2.0

Summary

  • An example that I use for experimentation, esp. re: concurrency.
  • Given that 10! = 7! x 6!, find other integers, a,b,c such that:
    • a! = b! x c!
    • Note there are trivial cases, which are not interesting but good sanity checks:
      • if a = c!, then a! = (a-1)! x c!
      • e.g. 24! = 23! x 4!
  • I typically avoid using BigInt or other assists.
    • That said, the data structures and algorithms are faily simplistic.

Note

  • usage: ./run.sh
  • tested with Java 21, Gradle wrapper 8.7
  • Worker objects process ranges of (a,b,c)
  • Calculator computes/caches factorials
  • Reporter logs hits