Skip to content

Instantly share code, notes, and snippets.

@SocraticPhoenix SocraticPhoenix/lol.java Secret
Last active Jul 20, 2017

Embed
What would you like to do?
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger integer = new BigInteger("15465347049748408180402050551405372385300458901874153987195606642192077081674726470827949979631079014102900173229117045997489671500506945449681040725068819");
BigInteger two = new BigInteger("2");
for (BigInteger i = new BigInteger("2"); i.compareTo(integer) < 0; i = i.add(two)) {
if(isPrime(i)) {
if (integer.remainder(i).compareTo(BigInteger.ZERO) == 0) {
System.out.println(i);
}
}
}
}
public static boolean isPrime(BigInteger integer) {
if(integer.remainder(new BigInteger("2")).compareTo(BigInteger.ZERO) == 0 || integer.remainder(new BigInteger("3")).compareTo(BigInteger.ZERO) == 0) {
return false;
}
BigInteger siz = new BigInteger("6");
for(BigInteger i = new BigInteger("6"); i.pow(2).compareTo(integer) < 0; i = i.add(siz)) {
if(integer.remainder(i.subtract(BigInteger.ONE)).compareTo(BigInteger.ZERO) == 0 ||
integer.remainder(i.add(BigInteger.ONE)).compareTo(BigInteger.ZERO) == 0) {
return false;
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.