Prove that for all integers a, b with a > b > 0,
a mod b < a / 2
Is 2n+1 = O(2n)?
Is 22n = O(2n)?
Is log2(n) = O(log4(n))?
Which function grows more quickly, sqrt(log N) or log(sqrt N)?
Consider this program:
n = int(input('Enter n: ')) while n > 1: if n % 3 == 0: n //= 3 else: print('no') break else: print('yes')
For which values of n will it print 'yes'?
What is its best-case and worst-case asymptotic running time as a function of n?
Consider this program:
n = int(input('Enter n: ')) s = 0 i = 1 while i < n: for j in range(n): s += j i *= 2
What is the program's running time as a function of n?
In the program, change "range(n)" to "range(i)". Now what is its running time?
Write a program that reads two fractions, one per line. Each fraction will consist of a numerator and denominator, separated by a slash. Compute the sum of the fractions and print it in reduced form. For example, if the input is
1/2 1/6
then the output will be
2/3
Solve Project Euler's problem 3:
What is the largest prime factor of the number 600851475143 ?
To do this, write a program that will print the largest prime factor of any integer N.
Write a program that reads an integer N and writes the same integer with the digits reversed. Do not use any string integers; instead, reverse the digits mathematically.
Solve Project Euler's problem 4:
A palindromic number reads the same both ways. Find the largest palindrome made from the product of two 3-digit numbers.