Solved

Converting binary to decimals

Convert binary to decimals. Example: 010111 = 23. 110000 = 48.

8 months ago

Solved

Binary code (array)

Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

8 months ago

Solved

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

8 months ago

Solved

Bit Reversal

Given an unsigned integer _x_, convert it to binary with _n_ bits, reverse the order of the bits, and convert it back to an inte...

8 months ago

Solved

Given an unsigned integer x, find the largest y by rearranging the bits in x

Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

8 months ago

Solved

Find out sum and carry of Binary adder

Find out sum and carry of a binary adder if previous carry is given with two bits (x and y) for addition. Examples Previo...

8 months ago

Solved

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

8 months 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: ...

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

8 months ago

Solved

(Linear) Recurrence Equations - Generalised Fibonacci-like sequences

This problem is inspired by problems <http://uk.mathworks.com/matlabcentral/cody/problems/2187-generalized-fibonacci 2187>, <htt...

8 months ago

Solved

Fibonacci Decomposition

Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, r...

8 months ago

Solved

How many Fibonacci numbers?

Find the number of unique Fibonacci numbers (don't count repeats) in a vector of positive integers. Example: x = [1 2 3 4...

8 months ago

Solved

Triangle sequence

A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

8 months ago

Solved

Number of Even Elements in Fibonacci Sequence

Find how many even Fibonacci numbers are available in the first d numbers. Consider the following first 14 numbers 1 1 2...

8 months ago

Solved

Fibonacci-Sum of Squares

Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

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

8 months ago

Solved

Integer sequence - 2 : Kolakoski sequence

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

8 months ago

Solved

Alternating sum

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

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

8 months ago

Solved

Is X a Fibonacci Matrix?

In honor of Cleve's new blog and post: <http://blogs.mathworks.com/cleve/2012/06/03/fibonacci-matrices/> Is X a Fibonacci ...

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

8 months 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),....

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

8 months ago

Solved

Solitaire Cipher

Implement the <http://en.wikipedia.org/wiki/Solitaire_(cipher) solitaire cipher>. Since this is from Wikipedia, I am capturin...

8 months ago

Solved

Implement simple rotation cypher

If given a letter from the set: [abc...xyz] and a shift, implement a shift cypher. Example: 'abc' with a shi...

8 months ago

Solved

Given a window, how many subsets of a vector sum positive

Given a vector: [1 0 -1 3 2 -3 1] and a window of 2, A sliding window would find: 1 + 0 = 1 0 - 1 = -1 ...

8 months ago

Solved

How many trades represent all the profit?

Given a list of results from trades made: [1 3 -4 2 -1 2 3] We can add them up to see this series of trades made a profit ...

8 months ago

Solved

Flag largest magnitude swings as they occur

You have a phenomenon that produces strictly positive or negative results. delta = [1 -3 4 2 -1 6 -2 -7]; Marching thr...

8 months ago

Solved

Make a run-length companion vector

Given a vector x, return a vector r that indicates the run length of any value in x. Each element in r shows how many times the ...

8 months ago