Python 2.7.8 on win32 -- IPython 2.3.1
In [1]: runfile('C:/Users/Lilian Besson/Documents/Python Scripts/CS101_FirstLabExam_Solutions.py', wdir='C:/Users/Lilian Besson/Documents/Python Scripts')
Problem 1 (1st kind) ==> The sum of all the positive integer numbers that are multiple of 7 or 11 and smaller than 50 is 306
Problem 1 (1st kind) ==> The sum of all the positive integer numbers that are multiple of 7 or 11 and smaller than 10000 is 11046042
Problem 1 (2nd kind) ==> The product of all the positive integer numbers that are multiple of 3 or 5 and smaller than 15 is 97200
Problem 1 (2nd kind) ==> The product of all the positive integer numbers that are multiple of 3 or 5 and smaller than 30 is 178564176000000
We added F_n = 0 ( for n = 0 ) to the current sum, which is now 0
We added F_n = 1 ( for n = 1 ) to the current sum, which is now 1
We added F_n = 1 ( for n = 2 ) to the current sum, which is now 2
We added F_n = 2 ( for n = 3 ) to the current sum, which is now 4
We added F_n = 3 ( for n = 4 ) to the current sum, which is now 7
Problem 2 (1st kind) ==> the sum of the first 5 Fibonacci numbers is 7
We added F_n = 0 ( for n = 0 ) to the current sum, which is now 0
We added F_n = 1 ( for n = 1 ) to the current sum, which is now 1
We added F_n = 1 ( for n = 2 ) to the current sum, which is now 2
We added F_n = 2 ( for n = 3 ) to the current sum, which is now 4
We added F_n = 3 ( for n = 4 ) to the current sum, which is now 7
We added F_n = 5 ( for n = 5 ) to the current sum, which is now 12
We added F_n = 8 ( for n = 6 ) to the current sum, which is now 20
We added F_n = 13 ( for n = 7 ) to the current sum, which is now 33
We added F_n = 21 ( for n = 8 ) to the current sum, which is now 54
We added F_n = 34 ( for n = 9 ) to the current sum, which is now 88
We added F_n = 55 ( for n = 10 ) to the current sum, which is now 143
We added F_n = 89 ( for n = 11 ) to the current sum, which is now 232
We added F_n = 144 ( for n = 12 ) to the current sum, which is now 376
We added F_n = 233 ( for n = 13 ) to the current sum, which is now 609
We added F_n = 377 ( for n = 14 ) to the current sum, which is now 986
We added F_n = 610 ( for n = 15 ) to the current sum, which is now 1596
We added F_n = 987 ( for n = 16 ) to the current sum, which is now 2583
We added F_n = 1597 ( for n = 17 ) to the current sum, which is now 4180
We added F_n = 2584 ( for n = 18 ) to the current sum, which is now 6764
We added F_n = 4181 ( for n = 19 ) to the current sum, which is now 10945
We added F_n = 6765 ( for n = 20 ) to the current sum, which is now 17710
We added F_n = 10946 ( for n = 21 ) to the current sum, which is now 28656
We added F_n = 17711 ( for n = 22 ) to the current sum, which is now 46367
We added F_n = 28657 ( for n = 23 ) to the current sum, which is now 75024
We added F_n = 46368 ( for n = 24 ) to the current sum, which is now 121392
We added F_n = 75025 ( for n = 25 ) to the current sum, which is now 196417
We added F_n = 121393 ( for n = 26 ) to the current sum, which is now 317810
We added F_n = 196418 ( for n = 27 ) to the current sum, which is now 514228
We added F_n = 317811 ( for n = 28 ) to the current sum, which is now 832039
We added F_n = 514229 ( for n = 29 ) to the current sum, which is now 1346268
Problem 2 (1st kind) ==> the sum of the first 30 Fibonacci numbers is 1346268
Problem 2 (2nd kind) ==>
For n = 0 its factorial n! is 1
For n = 1 its factorial n! is 1
For n = 2 its factorial n! is 2
For n = 3 its factorial n! is 6
For n = 4 its factorial n! is 24
For n = 5 its factorial n! is 120
For n = 6 its factorial n! is 720
For n = 7 its factorial n! is 5040
For n = 8 its factorial n! is 40320
For n = 9 its factorial n! is 362880
For n = 10 its factorial n! is 3628800
For n = 11 its factorial n! is 39916800
For n = 12 its factorial n! is 479001600
For n = 13 its factorial n! is 6227020800
Done, I printed the first 14 values of factorial n ( for n from 0 to 13 ).
For n = 18 its factorial is 6402373705728000
Problem 2 (2nd kind) ==> the smallest n such that n! > 10**15 is 18
In [2]: