ischarmichael := n -> `and`(op(

map(

p_e -> (

(p, e) -> (irem(n - 1, p - 1) = 0) and (e = 1)

)(op(p_e)),

ifactors(n)[2]

)

));

- "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!"

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}That last one, of course, is the infamous Bender-Flexo test.

ithprime {2,3,4}

factor 123456789

nextprime {10,100,1000}, prevprime {10,100,1000}

solve x^3+y^3=2716057 over integers

## No comments:

## Post a Comment