Wednesday, December 23, 2009

Fun stuff ahead

ischarmichael := n -> `and`(op(
p_e -> (
(p, e) -> (irem(n - 1, p - 1) = 0) and (e = 1)
  • "Charmichael? Prime? Congratulations! You satisfy every freshman's dream!"
    "Ghatage and Scott prove using Fermat's little theorem that (a+b)^n == a^n + b^n (mod n) (the freshman's dream) exactly when n is a prime or a Carmichael number" (source)
  • "3^2 x 29 x 41? Congratulations! You are 66.67% sexy!"
I have to say, though, that I need to start leveraging more powerful factorization and primality testing libraries for the back-end. Or Wolfram Alpha can just give me my API key already.
Okay, I found out that you can actually (ab)use Wolfram Alpha without an API key. Some fun queries that usually return results right away in plain scrapable text:
isprime {2,3,4}
ithprime {2,3,4}
factor 123456789
nextprime {10,100,1000}, prevprime {10,100,1000}
solve x^3+y^3=2716057 over integers
That last one, of course, is the infamous Bender-Flexo test.

No comments:

Post a Comment