This file contains hidden or 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.function.Consumer; | |
| public class BallsInBins { | |
| public static void traverseConfigurations (int nballs,int nbins,Consumer<int []> consumer) { | |
| traverseConfigurations(nballs,nbins,Integer.MAX_VALUE,consumer); | |
| } | |
| public static void traverseConfigurations (int nballs,int nbins,int capacity,Consumer<int []> consumer) { | |
| recurse (new int [nbins],nballs,capacity,0,consumer); | |
| } |
This file contains hidden or 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 Binomials { | |
| static BigInteger [] [] binomials = new BigInteger [0] [0]; | |
| public static BigInteger binomial (int n,int k) { | |
| if (k < 0 || n < 0) | |
| throw new UnsupportedOperationException (); | |
| if (k > n) | |
| return BigInteger.ZERO; |
This file contains hidden or 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; | |
| import java.util.function.Consumer; | |
| public class Question3600102 { | |
| static BigInteger count = BigInteger.ZERO; | |
| static BigInteger [] multiplicities = new BigInteger [5]; | |
| static { | |
| for (int i = 0;i <= 4;i++) | |
| multiplicities [i] = Binomials.binomial(4, i); | |
| } |
This file contains hidden or 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; | |
| import java.util.function.Consumer; | |
| public class Question3597830 { | |
| static BigInteger count = BigInteger.ZERO; | |
| static BigInteger [] multiplicities = new BigInteger [5]; | |
| static { | |
| for (int i = 0;i <= 4;i++) | |
| multiplicities [i] = Binomials.binomial(4, i); | |
| } |
This file contains hidden or 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 Question3594010 { | |
| public static void main(String [] args) { | |
| for (int [] p : Permutations.getPermutations (9)) { | |
| int n1 = getNumber(p,0); | |
| int n2 = getNumber(p,1); | |
| if (n1 - n2 == 33333) | |
| System.out.println(n1 + " - " + n2 + " = 33333"); | |
| } | |
| } |
This file contains hidden or 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; | |
| import java.util.HashSet; | |
| import java.util.Set; | |
| public class Question3588391 { | |
| public static void main(String [] args) { | |
| for (int n = 1;;n++) { | |
| int nvertices = 1 << n; | |
| Set<Long> edges = new HashSet<>(); | |
| for (long direction = 0,edge = 1;direction < n;direction++,edge <<= 1) |
This file contains hidden or 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 Question3578365 { | |
| static int count; | |
| static BigInteger result; | |
| public static void main(String [] args) { | |
| for (int n = 2;;n += 2) { | |
| count = 0; | |
| recurse (n,BigInteger.ZERO,0,new boolean [n]); |
This file contains hidden or 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 Question3576721 { | |
| final static long ntrials = 10000000000L; | |
| final static int nbins = 1000; | |
| final static int nmemories = 2; | |
| final static int nstates = 1 << nmemories; | |
| final static double minlog = -1.5; | |
| final static double maxlog = 1.5; | |
| final static Random random = new Random(); |
This file contains hidden or 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 Question3561819 { | |
| public static void main(String [] args) { | |
| int count = 0; | |
| int [] hand = new int [5]; | |
| for (hand [0] = 0;hand [0] < 52;hand [0]++) | |
| for (hand [1] = hand [0] + 1;hand [1] < 52;hand [1]++) | |
| for (hand [2] = hand [1] + 1;hand [2] < 52;hand [2]++) | |
| for (hand [3] = hand [2] + 1;hand [3] < 52;hand [3]++) |
This file contains hidden or 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 Question3570779 { | |
| final static int nscores = 6; | |
| final static int min = 3; | |
| final static int max = 18; | |
| static int count; | |
| public static void main(String [] args) { | |
| recurse (new int [nscores],0); | |