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年以上 前
解決済み
Alternating sum
Given vector x, calculate the alternating sum
y = x(1) - x(2) + x(3) - x(4) + ...
1年以上 前
解決済み
"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年以上 前
解決済み
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....
Langston's Ant
The <http://en.wikipedia.org/wiki/Langton%27s_ant Langston's Ant> Challenge is to determine the number of Black squares after K ...
1年以上 前
解決済み
Knave in the middle attack
This is a Matlab adaptation of the <http://en.wikipedia.org/wiki/Knights_and_Knaves Knights and Knaves> logical puzzles, mixed w...
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...
1年以上 前
解決済み
Approximation of Pi (vector inputs)
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...
1年以上 前
解決済み
geometric progression
I've modified my <http://uk.mathworks.com/matlabcentral/cody/problems/2800-arithmetic-progression previous program> so that it n...
1年以上 前
解決済み
arithmetic progression
I've written a program to generate the first few terms of <https://en.wikipedia.org/wiki/Arithmetic_progression arithmetic progr...
1年以上 前
解決済み
Find similar sequences
Another problem inspired by a question on the <http://www.mathworks.com/matlabcentral/answers answers> forum.
Given a matrix ...
1年以上 前
解決済み
Generate Square Wave
Generate a square wave of desired length, number of complete cycles and duty cycle. Here, duty cycle is defined as the fraction ...
1年以上 前
解決済み
Largest Geometric Series
Extension of Ned Gulley's wonderful Problem 317.
In a geometric series, ratio of adjacent elements is always a constant value. ...