Computer Science 15-100, Summer 2009
Class Notes: More Loops Practice
More Loops Practice
- Discover the following the math facts:
- 1/x + 1/x2 + 1/x3 + ...
= ? answer:
1/(x-1)
- 1 + 1/x + 1/x2 + 1/x3 +...
= ? answer:
x/(x-1)
- 1 - 1/x + 1/x2 - 1/x3 +...
= ? answer:
x/(x+1)
- 1 + 2/x + 3/x2 + 4/x3 +...
= ? answer:
[x/(x-1)]2
- 1 - 2/x + 3/x2 - 4/x3 +...
= ? answer:
[x/(x+1)]2
- round(phin/sqrt(5))
= ? answer:
fib(n)
[ n is a positive integer, phi = (1+sqrt(5))/2 ]
- The nth positive integer z such that either (5z2+4) or
(5z2-4) is a perfect square = ? answer:
fib(n)
- The sum of the reciprocals of the divisors of any perfect number
must add up to: ?. answer:
2
carpe diem -
carpe diem - carpe diem - carpe diem
- carpe diem - carpe diem -
carpe diem - carpe diem - carpe
diem