Energy Engineer

Solved

Convert this color - RGB Vector to Hex String

Given a 3 element RGB vector corresponding to a color (given by the MATLAB color spec <http://www.mathworks.com/help/matlab/ref/...

3 months ago

Solved

Convert hex color specification to MATLAB RGB

Here's something that comes up all the time if you deal with web pages. Given a <http://www.w3schools.com/html/html_colors.as...

3 months ago

Solved

Sort a list of complex numbers based on far they are from the origin.

Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

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

3 months ago

Solved

Right Triangle Side Lengths (Inspired by Project Euler Problem 39)

If _p_ is the perimeter of a right angle triangle with integral length sides, { _a_, _b_, _c_ }, there are exactly three solutio...

3 months ago

Solved

Find the longest sequence of 1's in a binary sequence.

Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

3 months ago

Solved

Let's get back to school, and create multiplication tables

For a given range, create multiplication tables. (start is always < endno) Example start = 17 endno = 19 Then, ...

4 months ago

Solved

Subtract integers and add doubles

Create a function that subtracts a from b if a and b are integers and adds them if they are floats.

4 months ago

Solved

Sum the 'edge' values of a matrix

Sum the 'edge' values of an input matrix (the values along the perimeter). Example [1 2 3 4 5 6 7 8 9] Output = ...

4 months ago

Solved

Given a 4x4 matrix, swap the two middle columns

If a = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; then the result is ans = 1 3 2 4 1 3 2...

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

4 months ago

Solved

The Goldbach Conjecture

The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

4 months ago

Solved

Project Euler: Problem 7, Nth prime

By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the Nth prime nu...

4 months ago