Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def summer(n, p1):
- sum1 = 0
- for i in range (1, p1):
- sum1 += 2 * n - 2 * i
- sum2 = (2 * n - p1)*(p1 - 1)
- return sum1 == sum2
- while True:
- n = random.randint(1, 1000)
- p1 = random.randint(1, 1000)
- res = summer(n, p1)
- print(res)
- if not res:
- break
- print("The formula is wrong!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement