Skip to content

Instantly share code, notes, and snippets.

View EdDuarte's full-sized avatar

Ed Duarte EdDuarte

View GitHub Profile
@EdDuarte
EdDuarte / Prime.java
Last active August 4, 2019 23:16
Primality tests (Trial division, Fermat and Miller-Rabin) in Java.
/**
* @author Ed Duarte (<a href="mailto:hi@edduarte.com">hi@edduarte.com</a>)
*/
public class Prime {
private java.security.SecureRandom random;
public Prime() {
this.random = new java.security.SecureRandom();
// from guava library
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.Range;
// change these two variables
final long nPeople = 23;
final long nDays = 365;
ContiguousSet<Long> matrix = ContiguousSet.create(

Keybase proof

I hereby claim:

  • I am edduarte on github.
  • I am edduarte (https://keybase.io/edduarte) on keybase.
  • I have a public key ASDbP2LiMvtfE-_kgoAsOfg7Nc5bgXzIgNhxLHf0Yxk3Uwo

To claim this, I am signing this object: