Solved

Hankelize a matrix

Similar to <http://www.mathworks.com/matlabcentral/cody/problems/42501-toeplitize-a-matrix Problem 42501. Toeplitize a matrix>, ...

8 mesi ago

Solved

Matrix of Multiplication Facts

This is James's daughter again, sneaking into his Cody account. Thanks to your help in my math class last year, I did great! B...

8 mesi ago

Solved

Go to the head of the class!

You're given a matrix and a single number. If that number is in the matrix, reorder the matrix so that number is in the first r...

8 mesi ago

Solved

Must be in the front row...

You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

8 mesi ago

Solved

Magnet and Iron

(Inspired from <http://www.mathworks.com/matlabcentral/cody/problems/112 Problem 112: Remove the air bubbles>) Iron (atomic n...

8 mesi ago

Solved

Replace Nonzero Numbers with 1

Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

8 mesi ago

Solved

Matrix multiplication across rows

Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix Example ...

8 mesi ago

Solved

A matrix of extroverts

Now that the introverts have had their script, the extroverts spoke up (naturally!) and demanded one as well. You will be given...

8 mesi ago

Solved

Convert matrix to 3D array of triangular matrices

Given a 2D numeric array x in which each column represents the vectorized form of an upper triangular matrix, return a 3D array ...

8 mesi ago

Solved

Too Many Zeros, Dump Them!

Sometimes when I create a matrix, I use this syntax: a = zeros(1000,1000); But when the function ends, I find that I don'...

8 mesi ago

Solved

Enlarge array

Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m...

8 mesi ago

Solved

Remove entire row and column in the matrix containing the input values

Remove the entire row and column from the matrix containing specific values. The specified value can be a scalar or a vector. Fo...

8 mesi ago

Solved

subtract central cross

Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.

8 mesi ago

Solved

MatCAT - Reconstruct X from Its X-rays

Consider a matrix x x = [ 1 2 0 0 5 0 3 0 8 ] If we sum x along the rows we get row_sums = [3 5 11] ...

8 mesi ago

Solved

matrix zigzag

Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

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

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

9 mesi ago

Solved

Mersenne Primes vs. All Primes

A Mersenne prime (M) is a prime number of the form M = 2^p - 1, where p is another prime number. <https://www.mathworks.com/matl...

9 mesi ago

Solved

Return fibonacci sequence do not use loop and condition

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: ...

9 mesi ago

Solved

Find the next Fibonacci number

In the sequence of Fibonacci numbers, every number is the sum of the two preceding ones: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...

9 mesi ago

Solved

Get all prime factors

List the prime factors for the input number, in decreasing order. List each factor. If the prime factor occurs twice, list it as...

9 mesi ago

Solved

Proper Factors

Generate the proper factors of input integer _x_ and return them in ascending order. For more information on proper factors, ref...

9 mesi ago

Solved

Multiples of a Number in a Given Range

Given an integer factor _f_ and a range defined by _xlow_ and _xhigh_ inclusive, return a vector of the multiples of _f_ that fa...

9 mesi ago

Solved

Project Euler: Problem 3, Largest prime factor

The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number being input, input might be ui...

9 mesi ago

Solved

Great Circle Distance

Find shortest between two points on a ball given their azimuthal and polar angles (in degrees) as well as the radius of the sphe...

9 mesi ago

Solved

Smallest distance between a point and a rectangle

Given two points *x* and *y* placed at opposite corners of a rectangle, find the minimal euclidean distance between another poin...

9 mesi ago

Solved

Clockwise or Counterclockwise

Given a list of 2-d points defining the vertices of a polygon, determine whether these points are sorted clockwise. The input...

9 mesi ago

Solved

Are you in or are you out?

Given vertices specified by the vectors xv and yv, and a single point specified by the numbers X and Y, return "true" if the poi...

9 mesi ago

Solved

Circumscribed circles

Given the lengths of the 3 sides of a triangle, output the radius of the circumscribed circle. Example: [3 4 5] -> 2.5

9 mesi ago