Rational Sum
Write a python program that prompts the user for a positive integer n and prints the sum of the rational numbers:
n∑i=11i=11+12+…+1n
Example
Enter a positive integer: 10
The rational sum is 2.9289682539682538
Factorial
Write a Python program that prompts the user for a positive integer and prints the factorial of the specified number. The factorial of a number n can be computed using the equation:
n!=n × (n − 1)×…×1
Example
Enter a positive integer: 10
The factorial is 3628800
Leibniz Approximation
The mathematical constant π is an irrational number that represents the ratio between a circle’s diameter and its circumference. The first algorithm designed to approximate π was developed by Archimedes in 250 BC, and was able to approximate its value within 3 significant figures. Today we know that there are an infinite number of digits in π, so lets use a little more sophisticated approach to estimate its value.
Details
Write a Python program that uses the Leibniz aprroximation to calculate and print an esitmate for the value of π. The program should prompt the user to enter the number of terms to use to use when calculating the estimate.
The Leibniz approximation relies on the fact that:
π4=11−13+15−17+…
Which can be rewritten to approximate the true value of π:
π=41−43+45−47+…
Example
Enter the number of terms: 1000
the approximate value of pi is 3.140592653839794
Hint
Fibonacci
The Fibonacci sequence is a sequence of numbers that looks like:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, …
Each number in the sequence, after the first two, is the sum of the previous two numbers in the sequence.
Details
Write a Python program that prints the Fibonacci sequence. The program should prompt the user for the length of the series to print.
Example
Enter the sequence length: 8
1 1 2 3 5 8 13 21
Hint
Submission
Please show your source code and run your programs for the instructor or lab assistant. Only a programs that have perfect functionality will be accepted as complete.