## Scala, 59 Bytes## def f(t:BigInt)=t.isProbablePrime(t.bitLength*9)&(1+t)%2==0 This function requires the input to be a `BigInt`. You can easily convert a string "162259276829213363391578010288127" (2**107-1 is a Mersenne prime) into `BigInt` by doing `BigInt("162259276829213363391578010288127")`. It might go wrong as the name of `isProbablePrime()` method suggests. But the probability is not more than `0.5^(t.bigLength)*9`. Standalone script version is 72 bytes long. val t=BigInt(args(0));print(t.isProbablePrime(t.bitLength*9)&(1+t)%2==0) Assume we save it as "t.scala", then then program can be run as >scala t.scala 162259276829213363391578010288127 >true