400 total contributions since 2019

commodity risk management

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

6 giorni 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...

11 giorni 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...

11 giorni 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),....

11 giorni 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....

13 giorni ago

Solved

Integer sequence - 2 : Kolakoski sequence

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

14 giorni 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 ...

14 giorni 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...

14 giorni 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 ...

15 giorni 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. ...

15 giorni 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 ...

15 giorni ago

Solved

Area of a triangle

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

15 giorni 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 ...

15 giorni 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...

17 giorni 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...

17 giorni 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...

17 giorni 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...

17 giorni ago

Solved

Alternating sum

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

17 giorni 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

17 giorni 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.

17 giorni ago

Solved

03 - Matrix Variables 6

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

17 giorni 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]...

17 giorni ago

Solved

surrounded matrix

With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones: A = [1 2 ...

18 giorni ago