315 total contributions since 2019

commodity risk management

Solved

cross in array

Make a cross from "1" in odd size array. Other value from array should be equal to "0"; As input you get length of side of arra...

environ 2 mois ago

Solved

What's size of TV?

Many people buy TV. Usually they ask about diagonal. But also important are width and height. Let's assume that all TV have rati...

environ 2 mois ago

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

environ 2 mois ago

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

environ 2 mois ago

Solved

Pentagonal Numbers

Your function will receive a lower and upper bound. It should return all pentagonal numbers within that inclusive range in ascen...

environ 2 mois 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 ...

environ 2 mois 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...

environ 2 mois ago

Solved

Factorize THIS, buddy

List the prime factors for the input number, in decreasing order. List each factor only once, even if the factorization includes...

environ 2 mois ago

Solved

Numbers with prime factors 2, 3 and 5.

Make a function which takes one positive integer n and returns a matrix with the numbers of the form (2^i)*(3^j)*(5^k) which are...

environ 2 mois ago

Solved

Find vampire numbers

A <http://en.wikipedia.org/wiki/Vampire_number vampire number> is a number v that is the product of two numbers x and y such th...

environ 2 mois 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...

environ 2 mois 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...

environ 2 mois 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...

environ 2 mois ago

Solved

Pernicious Anniversary Problem

Since Cody is 5 years old, it's pernicious. A <http://rosettacode.org/wiki/Pernicious_numbers Pernicious number> is an integer w...

environ 2 mois ago

Solved

Back to basics 8 - Matrix Diagonals

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

environ 2 mois ago

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

environ 2 mois ago

Solved

Add two numbers

Calculate the sum of two numbers. Example input = [2 3] output = 5

environ 2 mois ago

Solved

Find the largest value in the 3D matrix

Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

environ 2 mois ago

Solved

Find the sum of the elements in the "second" diagonal

Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

environ 2 mois ago

Solved

Pascal's Equilateral triangle inside a Matrix!!!

Given a number of row 'n', generate the following pascal's matrix 'p' where spaces are filled by 'zeros'. number of row, n = ...

environ 2 mois ago

Solved

Rearrange the given matrix to have all its zeros climb up to the top of each column - using for loops.

Given a matrix x, *using loops only* return a matrix y, in which all the zeros have "climbed" up to the top. That is, any zeros ...

environ 2 mois ago

Solved

Simulate one complete step in the Biham–Middleton–Levine traffic model

The <http://en.wikipedia.org/wiki/Biham%E2%80%93Middleton%E2%80%93Levine_traffic_model Biham–Middleton–Levine traffic model> is ...

environ 2 mois ago

Solved

angle in regular polygon

Make a function which returns measure of interior angle in x-side regular polygon. x is as input. Please pay attention, that 1 ...

environ 2 mois ago

Solved

Which coins to give

I was in shop today. I admired, how shop assistant had to think, which coins to give me. The task is we have a vector v=[0.5 0....

environ 2 mois ago

Solved

Solve the Sudoku Row

*Description* A simple yet tedious task occurs near the end of most Sudoku-solving algorithms, computerized or manual. The ta...

environ 2 mois ago

Solved

Is my wife right? Now with even more wrong husband

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

environ 2 mois ago

Solved

Basic commands - rounding

make a function which will round to integer, which is nearer to zero. Example x=[-2.5 2]; y=[-2 2];

environ 2 mois ago

Solved

Sudoku square

We have a small Sudoku square, but one number is missing. x = [ 1 5 4 8 6 3 0 9 7 ] Make a function, wher...

environ 2 mois ago

Solved

what can you get for exactly amount of money

You go to store, where each product has price. Prices are in vector s = [ 195 125 260 440 395 290] and you have amount ...

environ 2 mois ago

Solved

Basic commands - Greatest common divisor

Please write a function, which, will put as output greatest common divisor. Example: A = [-5 17; 10 0];...

environ 2 mois ago