def seq3np1(n):
""" Print the 3n+1 sequence from n, terminating when it reaches
1. args: n (int) starting value for 3n+1 sequence return: None
"""
while(n != 1):
print(n)
if(n % 2) == 0: # n is even
n = n // 2 else: # n is odd
n = n * 3 + 1
print(n) # the last print is 1
def main():
seq3np1(3)
main()
Using the provided code, alter the function as
follows:
First, delete the print statements...
6a. Show that 2/n = 1/3n + 5/3n and use this identity to obtain
the unit fraction decompositions of 2/25 , 2/65 , and 2/85 as given
in the 2/n table in the Rhind Mathematical Papyrus.
6b. Show that 2/mn = 1/ (m ((m+n)/ 2 )) + 1/ (n ((m+n)/ 2 )) and
use this identity to obtain the unit fraction decompositions of 2/7
, 2/35 , and 2/91 as given in the 2/n table in the Rhind
Mathematical Papyrus....
Derive the Sackur-Tetrode equation starting from the
multiplicity givenin Ch. 2:
Ω =(1/N!)(V^{N}/h^{3N})(pi^{3N/2}/3N^{2}!)(2mU)^{3N/2}
The Sackur-Tetrode equation is:
S=Nk[ln((V/N)((4pi*m*U)/(3Nh^{2}))^{3/2})+(5/2)]
Let sn be a Cauchy sequence such that ∀n > 1, n ∈ N, ∃m >
1, m ∈ N such that |sn − m| = 1/3 (this says that every term of the
sequence is an integer plus or minus 1/3 ). Show that the sequence
sn is eventually constant, i.e. after a point all terms of the
sequence are the same
a. Design a recursive algorithm for computing 3n for any
nonnegative integer n that is based on the formula 3n = 3n−1 + 3n−1
+ 3n−1 b. Set up a recurrence relation for the number of additions
made by the algorithm and solve it. c. Draw a tree of recursive
calls for this algorithm and count the number of calls made by the
algorithm. d. Is it a good algorithm for solving this problem?