Solved

Amicable numbers

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

3 mesi 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...

3 mesi 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....

3 mesi 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...

3 mesi 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 ...

3 mesi 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. ...

3 mesi 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...

3 mesi 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...

3 mesi 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...

3 mesi 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...

3 mesi 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 (...

3 mesi 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...

3 mesi 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...

3 mesi 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, ...

3 mesi 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...

3 mesi 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...

3 mesi 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....

3 mesi 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...

4 mesi ago

Solved

Ordinal numbers

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

10 mesi 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...

10 mesi 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...

10 mesi ago

Solved

Fibonacci Decomposition

Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, r...

10 mesi ago

Solved

Given a matrix A return a vector of the product of the elements in each column using a loop without using prod.

--------------------- for m: 3 1 3 3 10 1 9 1 9 4 1 4 5 6 5 ...

11 mesi ago

Solved

Given a matrix A (size m x n) create a matrix B which consists of matrix A sorted in descending order by columns and then by rows.

--------------- A= [ 2 6 -3 7 12 0 -12 5 1] --------------- B= [12 7 1 6 2 0 5 -3 ...

11 mesi ago

Solved

Given a matrix A (size m x n) create a matrix B (size m+2 x n+2) which consists of matrix A surrounded by zeros. See Example below:

A = [1 2 3 4 5 6] ----------- B = [0 0 0 0 0 0 1 2 3 0 0 4 5 6 0 0 0 0 0 0]

11 mesi ago

Solved

Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1}

if v1 is [1 2 3 4 5 6 7 8] then v2 should be [3 5 7 9 11 13 15]. if v1 is [1; 3; 5; 7] the...

11 mesi ago

Solved

Given n, create n random numbers such that their standard deviation is also n.

Given n, create n random numbers such that their standard deviation is also n.

11 mesi ago

Solved

Bouncy numbers

Inspired by Project Euler n°112. * * Working from left-to-right if no digit is exceeded by the digit to its left it is call...

11 mesi ago

Solved

Pandigital number n°2 (Inspired by Project Euler 32)

After <http://www.mathworks.com/matlabcentral/cody/problems/2319 Problem 2319>. An n-digit number is pandigital if it makes u...

11 mesi ago