402 total contributions since 2019

commodity risk management

Solved

How many bottles can you drink?

Sometimes if you buy a drink in a glass bottle you can return that bottle and get some money back. Let's assume we have "x" a...

14 hours ago

Solved

Golomb's self-describing sequence (based on Euler 341)

The Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G...

8 days ago

Solved

Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)

Given a number _n_, return the terminal value of the number chain formed by summing the square of the digits. According to the P...

13 days ago

Solved

"Look and say" sequence

What's the next number in this sequence? * [0] * [1 0] * [1 1 1 0] * [3 1 1 0] * [1 3 2 1 1 0] This a variant on the w...

13 days ago

Solved

Sum of first n terms of a harmonic progression

Given inputs a, d and n, return the sum of the first n terms of the harmonic progression a, a/(1+d), a/(1+2d), a/(1+3d),....

14 days ago

Solved

Find the stride of the longest skip sequence

We define a _skip sequence_ as a regularly-spaced list of integers such as might be generated by MATLAB's <http://www.mathworks....

15 days ago

Solved

Integer sequence - 2 : Kolakoski sequence

Get the n-th term of <https://oeis.org/A000002 Kolakoski Sequence>.

16 days ago

Solved

Integer Sequence - II : New Fibonacci

Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also ...

16 days ago

Solved

Create a square matrix of multiples

Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row. This also applies...

17 days ago

Solved

Given area find sides

In a right angle triangle given area 'A' one arm=x, another arm=2x then find the value of x. For example, area A=400 then ...

18 days ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

18 days ago

Solved

Make a 1 hot vector

Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

18 days ago

Solved

Area of a triangle

A triangle is given with base *'b'* ,vertical hight *'h'* . then find it's area.

18 days ago

Solved

02 - Vector Variables 3

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_2c.png>> (all the numbers from 5 to -5 in increments of ...

18 days ago

Solved

Back to basics 1 - Saving

Covering some basic topics I haven't seen elsewhere on Cody. Given an input variable 'x', save it to disk in a file named 'co...

19 days ago

Solved

03 - Matrix Variables 1

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3a.png>> A 9x9 matrix full of 2's (Hint: use *ones* o...

19 days ago

Solved

Return elements unique to either input

Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

19 days ago

Solved

Return unique values without sorting

If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

19 days ago

Solved

Alternating sum

Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

19 days ago

Solved

Back to basics 14 - Keywords

Covering some basic topics I haven't seen elsewhere on Cody. Return a cell array of all MATLAB keywords

20 days ago

Solved

Back to basics 15 - classes

Covering some basic topics I haven't seen elsewhere on Cody. Return the class of the input variable.

20 days ago

Solved

03 - Matrix Variables 6

Make _fMat_ be a 5x3 matrix of random integers with values from -3 to 3 (Hint: use *randi*)

20 days ago

Solved

Sum the numbers on the main diagonal

Sum the numbers on the main diagonal of an n-by-n matrix. For input: A = [1 2 4 3 6 2 2 4 7]...

20 days ago