Solved


So many choices
For inputs _n_ and _k_ (in that order), output the number of ways that k objects can be chosen from amongst n distinct objects. ...

2 years ago

Solved


Lowest sum from a group of digits
Hi there. It's James's daughter here again, and my third grade math teacher is up to her old tricks. This time, she's giving u...

2 years ago

Solved


Maximum sum from any 2 numbers with a variable number of inputs
Given a variable number of inputs, combine any 2 numbers from the inputs and output the maximum sum the combinations can generat...

2 years ago

Solved


Red and green towers
Frankie has a large number of wooden cubes, painted in red and green. He is building little towers with his cubes, by stacking t...

2 years ago

Solved


A (wrong) place for everything, and everything in its (wrong) place
You have an equal number of cups and balls, each labelled from one to N. You randomly place one ball in each cup. Determine th...

2 years ago

Solved


Numbered lottery balls into cells
You are running a lottery, and have a number of different balls numbered 1 to N. Your job is to figure out how many different w...

2 years ago

Solved


NCHOOSEK - Time Optimization
*Input* * *V* —— Set of all choices, a vector of N, 1 < N < 100 * *K* —— Number of selected choices, a scalar, 0 <= K <=...

2 years ago

Solved


Hexagonal Tiling Dots in a Circle
Return how many <http://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling> grid points there are inside a circle of radius _...

2 years ago

Solved


Minimum Distance Point to Segment
This Challenge is to determine the minimum distance from a 2-D line segment defined by two points to a point. The point is (p...

2 years ago

Solved


Perimeter
Given a sequence of points forming a closed path (first and last points are coincident) return the perimeter value. For example...

2 years ago

Solved


Shifted Hexagonal Tiling Dots in a Circle
Return how many <http://en.wikipedia.org/wiki/Hexagonal_grid Hexagonal Tiling> grid points there are inside a circle of radius _...

2 years ago

Solved


Edges of a n-dimensional Hypercube
Return the number of edges on an <http://en.wikipedia.org/wiki/Hypercube _n_-dimensional hypercube> (with an integer n &ge; 0). ...

2 years ago

Solved


Dots in a Sphere
Return how many integer grid points there are inside a 3D sphere of radius _r_ centred at (0,0,0) (including points on the edge)...

2 years ago

Solved


Dots in a Circle
Return how many integer grid points there are inside a circle of radius _r_ centred at (0,0) (including points on the edge). ...

2 years ago

Solved


Put m balls into n boxes (again)
According to <http://www.mathworks.com/matlabcentral/cody/problems/1516-put-m-balls-into-n-boxes Cody Problem 1516>, if I put 3 ...

2 years ago

Solved


Put m balls into n boxes
Can you find all the cases where, if I put 3 balls into 2 boxes the case is 1 1 1 1 1 2 1...

2 years ago

Solved


Which way to go?
Given an m*n grid, How many ways are there to go from upper left corner to the lower right one? You can only move right...

2 years ago

Solved


Number of paths on a grid
Consider a grid formed by n vertices vertically down, and m vertices horizontally right. Your starting point is at the top lef...

2 years ago

Solved


Generate binary combinations for a given number of bit(s)
Generate the binary combination as in the example below. Example: If you are given: bin_comb(2) The answer will be: ...

2 years ago

Solved


Get ranking of a combination looking for speed.
I have the numbers pulled without replacement from the set [1 2 3 4 5 6 7 8 9 10 11 12 13]; They are then ordered from least to...

2 years ago

Solved


Create Combination
Motivation: In many problems, we need to create combinations with the function nchoosek. In some cases, however, choices are lim...

2 years ago

Solved


Get ranking of a combination
I have the numbers pulled without replacement from the set [1 2 3 4 5 6 7 8 9 10 11 12 13]; They are then ordered from least to...

2 years ago

Solved


Combinations without using nchoosek
You have to generate a matrix with all possible combinations of n elements *taken 2* at a time, *without using nchoosek(1:n,2)* ...

2 years ago

Solved


Possible Outcomes of American Roulette
The payout for American roulette can be calculated by: payout = (38/n)-1 where n is the number of squares the bet covers. ...

2 years ago

Solved


The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

2 years ago

Solved


Circular Primes (based on Project Euler, problem 35)
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. The...

2 years ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

2 years ago

Solved


Find nearest prime number less than input number
Find nearest prime number less than input number. For example: if the input number is 125, then the nearest prime number whi...

2 years ago

Solved


Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

2 years ago

Solved


Find the next prime number
Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

2 years ago

Load more