Question: Problem 1 3 . ( Counting Primes ) Write a program called prime _ counter.py that accepts n ( int ) as command - line

Problem 13.(Counting Primes) Write a program called prime_counter.py that accepts n(int) as command-line argument, and
writes to standard output the number of primes less than or equal to n.
-/vorkspace/controlf1ow-programs
python3 prime_counter,py 10
4
8 python3 prime_counter.py 100
25
$ python3 prime_counter, py 1000
168
Problem 14.(Perfect Numbers) A perfect number is a positive integer whose proper divisors add up to the number. For
example, 6 is a perfect number since its proper divisors 1,2, and 3 add up to 6. Write a program called perfect_numbers.py that
accepts n(int) as command-line argument, and writes to standard output the perfect numbers that are less than or equal to
n.
2_-/workspace/controlflou-prograns
python3perfectnumbers.py10
python3perfectnumbers.py1000
Problem 15.(Ramanujan Numbers) Srinivasa Ramanujan was an Indian mathematician who became famous for his intuition
for numbers. When the English mathematician G. H. Hardy came to visit him one day, Hardy remarked that the number of
his taxi was 1729, a rather dull number. Ramanujan replied, "No, Hardy! It is a very interesting number. It is the smallest
number expressible as the sum of two cubes in two different ways." Verify this claim by writing a program ramanujan_numbers.py
that accepts n(int) as command-line argument, and writes to standard output all integers less than or equal to n that can
be expressed as the sum of two cubes in two different ways. In other words, find distinct positive integers a,b,c, and d such
that a3+b3=c3+d3n
-/Horzspace/controlt10y-programs
8 python3 ramanujan_numbers. py 10000
1729=1-3+12-3=9-3+10-3
4104=2-3+163+15*3
$ python3 ramanujan numbers. py 40000
13832=2-3+24-3=18-3+20-3
39312=2-3+34-3=15-3+33-3
32832=4-3+32-3=+18-3+30-3
20683=10%3+27=3=19:3+24*3
Problem 1 3 . ( Counting Primes ) Write a program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!