Solved

Unique dice configurations

Given a number of dice N and the number of sides on each die S, write a MATLAB function that will output how many unique permuta...

2 years ago

Solved

Coin Tossing: Probability of Same Heads for N tosses

A pair of physicists toss a coin n times each. What is the probability that they tossed the same number of heads? *Input:*...

2 years ago

Solved

Don't be mean. Be nice!

For this problem, you will be given a range of single digits R, and a separate number K. You job is to calculate the mean of al...

2 years ago

Solved

find nth even fibonacci number

1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..

2 years ago

Solved

Bell Triangle

Form the bell triangle upto nth bell number posotion; * if n=5 * y= [1 0 0 0 0; 1 2 0 0...

2 years ago

Solved

Frugal number

check whether n is a frugal number * a frugal number is a natural number in a given number base that has more digits than the...

2 years ago

Solved

Pell numbers

Find the nth pell number <https://en.wikipedia.org/wiki/Pell_number>

2 years ago

Solved

Amicable numbers

Test whether two numbers are <https://en.wikipedia.org/wiki/Amicable_numbers amicable>, meaning that the sum of the proper divis...

2 years ago

Solved

Iccanobif numbers 1

There are a lot of problems in Cody that deal with Fibonacci numbers (1, 1, 2, 3, 5, 8, 13, 21 etc...) so let's turn things arou...

2 years ago

Solved

Last non-zero digit

Given a number n, find the last non-zero digit of the factorial of that number. You need to take care of the large values of n....

2 years ago

Solved

Project Euler: Problem 18, Maximum path sum I

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bott...

2 years ago

Solved

Sum of big primes without primes

Inspired by Project Euler n°10 (I am quite obviously a fan). With problem n°250 by Doug, you can find some global methods to ...

2 years ago

Solved

Snakes on a plane

Given the dimensions of a 2-d plane, create a matrix where a "snake" of ones occupies the plane from top left to bottom right. ...

2 years ago

Solved

Balanced Ternary Numbers: Easy as |, |-, |o

This problem concerns the so-called <http://en.wikipedia.org/wiki/Balanced_ternary balanced ternary> system for representing num...

2 years ago

Solved

Generating random matrix with given probability mass function

Inspired by <http://www.mathworks.com/matlabcentral/cody/problems/2356-simulating-the-selection-of-a-state-with-given-probabilit...

2 years ago

Solved

Guess the number I'm thinking of

In this game you are competing against two other people to guess the number that I'm thinking of. # I randomly choose an *i...

2 years ago

Solved

Create a random vector of integers with given sum

Your task today is to write a function that returns a vector of integer numbers, between, and including, 1 and m, of which the s...

2 years ago

Solved

Decrypt the cypher using XOR encryption (for beginners)

Inspired by Project Euler n°59 Each character on a computer is assigned a unique code and the preferred standard is ASCII (...

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

Pandigital Factors (Based on Euler 491)

A Pandigital Number is a number containing all of the digits from 0-9 inclusive, with the added stipulation that it does not hav...

2 years ago

Solved

It's going down. We're finding simbers!

This problem is inspired by Project Euler 520: Simbers. "We define a simber to be a positive integer in which any odd digit, ...

2 years ago

Solved

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

2 years ago

Solved

Fix the last element of a cell array

Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

2 years ago

Solved

Remove element(s) from cell array

You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

2 years ago

Solved

Combined Ages 1 - Symmetric, n = 3

You have probably seen the common riddle wherein combined ages are provided and you must determine the individual ages. For exam...

2 years ago

Solved

Ordinal numbers

Given an integer n, return the corresponding ordinal number as a character string. For example, ord(1)='1st' ord(2)=...

2 years ago

Solved

hanoi towers II

with 3 rods (1,2 & 3), the goal is to move a tower of n disks from rod #1 to rod #3. You can move disks only one by one, on the...

2 years ago

Solved

(Linear) Recurrence Equations - Generalised Fibonacci-like sequences

This problem is inspired by problems <http://uk.mathworks.com/matlabcentral/cody/problems/2187-generalized-fibonacci 2187>, <htt...

2 years ago