Prove or disprove: $99^{100}+100^{101}+101^{99}+1$ is a prime number
Here is a simple Python script to calculate $a^b$ mod $p$:
def powmod(a, b, p):
if b==0: return 1
tmp = powmod(a, b/2, p)**2
if b%2!=0: tmp *= a
return tmp%p
To check divisibility of your function by $p$, you can use:
def ck(p):
val = powmod(99,100,p) + powmod(100,101,p) + powmod(101,99,p) + 1
return (val%p == 0)
Finally, testing all the numbers through $10^6$ for divisibility:
>>> filter(ck, xrange(2,1000000))
[825277]
So it's not prime.
Similar Mathematica code is FactorInteger[99^100 + 100^101 + 101^99 + 1, 2]
which returns $825277$ and $\frac{99^{100} + 100^{101} + 101^{99} + 1}{825277}$.
To promote Sage:
sage: a = 99^100 + 100^101 + 101^99 + 1
sage: N = 10^100
sage: for p in primes(N):
....: if a % p == 0:
....: print p
....: break
....:
825277