Solved


Mobius function
From wikipedia: For any positive integer n, define μ(n) as the sum of the primitive n-th roots of unity. It has values in {−1, ...

1 year ago

Solved


Not square-free number sequence
Not square-free numbers are all positive integers divisible by a square greater than one: 4, 8, 9, 12, 16, 18, 20, 24, 25, 27, ....

1 year ago

Solved


Sphenic number sequence
Sphenic numbers are positive integers that are products of three distinct prime numbers: 30, 42, 66, 70, 78, 102, 105, 110, 114,...

1 year ago

Solved


Monte-Carlo integration
Write a function that estimates a d-dimensional integral to at least 1% relative precision. Inputs: * d: positive integer....

1 year ago

Solved


Reproduce this plot!
Write a function that will take a dataset (x,y), a best fit model (model), and the upper and lower prediction bounds (lb,ub) for...

1 year ago

Solved


Power Outages Histogram
Create a function that takes power outage data as an input and creates a histogram of the number of outages as a function of Reg...

1 year ago

Solved


Plotting Practice
Plot cos(x) vs x as shown in the figure below. Include the appropriate title, x-label, and y-label. Note, it is case sensitive. ...

1 year ago

Solved


Find the next prime number
Find the next prime number or numbers for given n. For example: n = 1; out = 2; or n = [5 7]; out = [7 11]; ...

1 year ago

Solved


Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

1 year ago

Solved


Largest Twin Primes
<http://en.wikipedia.org/wiki/Twin_prime Twin primes> are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Giv...

1 year ago

Solved


Mersenne Primes
A Mersenne prime is a prime number of the form M = 2^p - 1, where p is another prime number. For example, 31 is a Mersenne prim...

1 year ago

Solved


Find nearest prime number less than input number
Find nearest prime number less than input number. For example: if the input number is 125, then the nearest prime number whi...

1 year ago

Solved


Sophie Germain prime
In number theory, a prime number p is a *Sophie Germain prime* if 2p + 1 is also prime. For example, 23 is a Sophie Germain prim...

1 year ago

Solved


Circular Primes (based on Project Euler, problem 35)
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. The...

1 year ago

Solved


Easy Sequences 5: Project Euler Problem 1 - Again!
We are all familiar with Project Euler Problem 1. This time let's try it on bigger multiples and larger range. Find the sum of ...

1 year ago

Solved


Easy Sequences 10: Sum of Cumsums of Fibonacci Sequence
The function F(n) is defined as the set of Fibonacci numbers from the first up to the n-th. S(n) is the result of applying to F,...

1 year ago

Solved


Easy Sequences 11: Factorial Digits without Trailing Zeros
Here is an easy one... It is not difficult to count the number of digits of the factorial of a given number. For example for 'n...

1 year ago

Solved


Easy Sequences 9: Faithful Pairs
A "faithful number" is a non-prime number that is one less or one more than some prime number but not both. For example, for num...

1 year ago

Solved


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

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

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

1 year ago

Solved


Sum the Infinite Series
Given that 0 < x and x < 2*pi where x is in radians, write a function [c,s] = infinite_series(x); that returns with the...

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

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

1 year 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),....

1 year ago

Solved


Calculate a modified Levenshtein distance between two strings
Inspired by the Cody problem found here. The Levenshtein distance is a charater-based string metric used to measure the differe...

1 year ago

Solved


Space Saver
Remove all characters that are below a space in ASCII value.

1 year ago

Solved


Reverse the Words (not letters) of a String
*Description* Change the words of a string such that the words appear in reverse order. You may assume that the string is a n...

1 year ago

Solved


Find Rotated Substring
Given a string s1, find if a rotated version of s1 is present in a second string s2. For example, rotated version of some str...

1 year ago

Load more