Dogsbody

Solved

Project Euler: Problem 10, Sum of Primes

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below the input, N. Thank you <http:/...

3 months ago

Solved

Remove any row in which a NaN appears

Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

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

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

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

5 months ago

Solved

Acid and water

⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ ⚖ Assume that there is a 100 liter tank. It is initially fi...

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

6 months ago

Solved

Given a square and a circle, please decide whether the square covers more area.

You know the side of a square and the diameter of a circle, please decide whether the square covers more area.

6 months ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

6 months ago

Solved

Approximation of Pi

Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

6 months ago

Solved

Pi Estimate 1

Estimate Pi as described in the following link: <http://www.people.virginia.edu/~teh1m/cody/Pi_estimation1.pdf>

6 months ago

Solved

Calculate area of sector

A=function(r,seta) r is radius of sector, seta is angle of sector, and A is its area. Area of sector A is defined as 0.5*(r^2...

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

6 months ago

Solved

High school cafeteria

Given an input vector of positive integers, return a row vector with the primes first (in increasing order) and the composites n...

6 months ago

Solved

Large Sum (inspired by Project Euler 13)

Your function will be provided an arbitrary number of numbers of arbitrary sizes as a cell array of strings. Some numbers will b...

6 months ago

Solved

Project Euler: Problem 16, Sums of Digits of Powers of Two

2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^N? Thanks ...

6 months ago

Solved

Determine whether a vector is monotonically increasing

Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

1 year ago

Solved

The 5th Root

Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...

1 year ago

Solved

Right and wrong

Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

1 year ago

Solved

Too mean-spirited

Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

1 year ago

Solved

Swap the input arguments

Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

1 year ago

Solved

radius of a spherical planet

You just measured its surface area, that is the input.

1 year ago

Solved

Distance walked 1D

Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

1 year ago

Solved

How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

1 year ago

Solved

The Hitchhiker's Guide to MATLAB

Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

1 year ago

Solved

Reverse the vector

Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

1 year ago

Solved

Simple equation: Annual salary

Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

1 year ago