This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.PrintStream; | |
import java.util.Random; | |
public class Question4390837 { | |
final static int a = 2; | |
final static int b = 2; | |
final static int ntrials = 100000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package games.chess.fide; | |
import java.io.IOException; | |
import org.jsoup.Jsoup; | |
import org.jsoup.nodes.Element; | |
public class WorldRankingExtracter { | |
public static void main(String [] args) throws IOException { | |
int rank = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashSet; | |
import java.util.Set; | |
public class Question3706460 { | |
public static void main(String [] args) { | |
Set<Long> strings = new HashSet<>(); | |
strings.add(1L); | |
long bit = 2; | |
boolean one = false; | |
for (int n = 1;;n++,bit <<= 1,one = !one) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Question3674864 { | |
final static long ntrials = 10000000; | |
final static Random random = new Random(); | |
public static void main (String [] args) { | |
long count = 0; | |
for (long trial = 0;trial < ntrials;trial++) { | |
int [] state = new int [6]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
public class Question3674784 { | |
public static void main(String [] args) { | |
for (int n = 1;;n++) { | |
System.out.println(n); | |
BigInteger diff = BigInteger.TEN.pow(n).subtract(BigInteger.ONE).divide(BigInteger.TEN.subtract(BigInteger.ONE)); | |
BigInteger x = BigInteger.TWO; | |
BigInteger x2 = x.multiply(x); | |
BigInteger y = BigInteger.ONE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Random; | |
public class Question3667404 { | |
final static long ntrials = 10000000; | |
final static Random random = new Random(); | |
static class Range { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Question3664030 { | |
public static void main(String [] args) { | |
for (int n = 1;n < 2000;n++) { | |
int count = 0; | |
boolean [] hit = new boolean [n]; | |
for (int k = 1;k <= n + 1;k++) { | |
double x = 1. / k; | |
// to count values on boundaries only towards the lower interval, subtract 1e-12 here ... | |
int index = (int) (n * x); | |
if (index < n && !hit [index]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class Question3629762 { | |
static class Constraint { | |
int [] cells; | |
int sum; | |
public Constraint(int [] cells) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class Question3629474 { | |
final static long ntrials = 100000000; | |
final static Random random = new Random(); | |
public static void main(String [] args) { | |
double sum = 0; | |
for (long n = 0;n < ntrials;n++) | |
sum += Math.abs(angle() - angle()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.function.Consumer; | |
import java.util.stream.Collectors; | |
import BallsInBins; // https://gist.github.com/joriki/d324726fbc3fe4ccdf33628aa02b790c | |
import BigRational; // https://gist.github.com/joriki/3097452fbb9e1983daf1035f57e72722 | |
import Binomials; // https://gist.github.com/joriki/5a5c03d2c286effa69584e77a064a6e3 |