def squareRoot(n):
x = n
y = 1
e = 0.000001
while (x - y > e):
x = (x + y) / 2
y = n/x
return x
def findMaximumHeight(N):
n = 1 + 8*N
maxh = (-1 + squareRoot(n)) / 2
return int(maxh)
N = 12
print(findMaximumHeight(N))
Solve Problems by Coding Solutions - A Complete solution for python programming
def squareRoot(n):
x = n
y = 1
e = 0.000001
while (x - y > e):
x = (x + y) / 2
y = n/x
return x
def findMaximumHeight(N):
n = 1 + 8*N
maxh = (-1 + squareRoot(n)) / 2
return int(maxh)
N = 12
print(findMaximumHeight(N))
import math
def productPrimeFactors(n):
product = 1
if (n % 2 == 0):
product *= 2
while (n%2 == 0):
n = n/2
for i in range (3, int(math.sqrt(n)), 2):
if (n % i == 0):
product = product * i
while (n%i == 0):
n = n/i
if (n > 2):
product = product * n
return product
n = 44
print (int(productPrimeFactors(n)))