Solved

Set some matrix elements to zero

First get the maximum of each *row*, and afterwards set all the other elements to zero. For example, this matrix: 1 2 3 ...

bijna 3 jaar ago

Solved

Permute diagonal and antidiagonal

Permute diagonal and antidiagonal For example [1 2 3;4 5 6;7 8 9] -> [3 2 1;4 5 6;9 8 7] WITHOUT diag function (and variable n...

bijna 3 jaar ago

Solved

N-Dimensional Array Slice

Given an N-dimensional array, _A_, an index, _I_, and a dimension, _d_, return the _I_ th elements of _A_ in the _d_ dimension. ...

bijna 3 jaar ago

Solved

Operate on matrices of unequal, yet similar, size

You may want to add a vector to a matrix, implying that the vector is added to each column of the matrix. Or multiply a 3x4x5 ma...

bijna 3 jaar ago

Solved

Some Assembly Required

The input to this function is a matrix of real numbers. Your job is to assemble the rows of the matrix into one large row that ...

bijna 3 jaar ago

Solved

Remove NaN ?

input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

bijna 3 jaar ago

Solved

Back to basics 21 - Matrix replicating

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

bijna 3 jaar ago

Solved

Points on a Sphere

Given a sphere of radius R, determine how many points on the surface of that sphere have three integer coordinates. Do not outp...

bijna 3 jaar ago

Solved

Dots in a Diamond

Return how many <http://en.wikipedia.org/wiki/Diamond_cubic Diamond Cubic> lattice grid points there are inside a 3D sphere of r...

bijna 3 jaar ago

Solved

Determine if a Given Number is a Triangle Number

*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

bijna 3 jaar ago

Solved

Parasitic numbers

Test whether the first input x is an n-parasitic number: <http://en.wikipedia.org/wiki/Parasitic_number>. ( _n_ is the second in...

bijna 3 jaar ago

Solved

Compute Fibonacci Number

Compute the _n_-th Fibonacci Number f(0) = 0, f(1) = 1, f(2) = 1, f(3) = 2, ... f(42) = 267914296

bijna 3 jaar ago

Solved

Kaprekar numbers

Test if the input is a Kaprekar number: <http://mathworld.wolfram.com/KaprekarNumber.html>. Return a logical true or false. ...

bijna 3 jaar ago

Solved

Narcissistic number ?

Inspired by Problem 2056 created by Ted. In recreational number theory, a narcissistic number is a number that is the sum of ...

bijna 3 jaar ago

Solved

Find the 9's Complement

Find the 9's complement of the given number. An example of how this works is <http://electrical4u.com/9s-complement-and-10s-c...

bijna 3 jaar ago

Solved

Armstrong Number

Determine whether the given input n-digit number is Armstrong Number or not. Return True if it is an Armstrong Number. An n-D...

bijna 3 jaar ago

Solved

Evil Number

Check if a given natural number is evil or not. Read more at <https://oeis.org/A001969 OEIS>.

bijna 3 jaar ago

Solved

Smith numbers

Return true if the input is a Smith number in base ten. Otherwise, return false. Read about Smith numbers at <http://en.wikipedi...

bijna 3 jaar ago

Solved

Is this number Munchhausen Narcissistic?

In this problem, simply return 1 if a supplied number is Munchhausen narcissistic or 0 if not. Example 153 is narcissistic...

bijna 3 jaar ago

Solved

Polite numbers. N-th polite number.

A polite number is an integer that sums of at least two consecutive positive integers. For example _7 = 3+4_ so 7 is a polite...

bijna 3 jaar ago

Solved

Bell Number calculator

Calculate a vector of Bell numbers for sets up to length n. Bell numbers are the maximum number of partitions of a set. See the ...

bijna 3 jaar ago

Solved

N-th Odious

Given index n return n-th <https://oeis.org/A000069 odious number>.

bijna 3 jaar ago

Solved

Polite numbers. Politeness.

A polite number is an integer that sums of two or more consecutive positive integers. Politeness of a positive integer is a num...

bijna 3 jaar ago

Solved

Polygonal numbers

The task of <http://www.mathworks.co.uk/matlabcentral/cody/problems/5 Problem 5> is to calculate triangular numbers. By playing ...

bijna 3 jaar ago

Solved

nth Rational Number

Return the nth rational number. This is the inverse to Problem <http://www.mathworks.com/matlabcentral/cody/problems/1471 1...

bijna 3 jaar ago

Solved

Generalised Hamming Number

Inspired by Project Euler n°204 and Problem 1308 by James A generalised Hamming number of type n, has no prime factor larger ...

bijna 3 jaar ago

Solved

Generate a Parasitic Number

This problem is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/156-parasitic-numbers Problem 156>. ...

bijna 3 jaar ago

Solved

Find perfect placement of non-rotating dominoes (easier)

Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

bijna 3 jaar ago

Solved

Number of Horns on a unicorn!

Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

bijna 3 jaar ago

Solved

First N Perfect Squares

*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];

bijna 3 jaar ago