Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Square-Triangle Numbers
""" This program finds numbers that are both square and triangular. A square number can be written in the form n*n. A triangular number can be written in the form a(a+1)/2. With some manipulation of the two equations, you can generate the formua that is used. """ from math import sqrt a:int = 0 while True: a = a+1 b = 8 * a * a + 1 c = sqrt(b) if c % 1 == 0: print(a*a)
run
|
edit
|
history
|
help
0
Page 353 ex 42
15
Va
("Hello,world!")
Python.py
Rextester
contarsucesoresmayores
kaam ki chiz
Python Monthly Calendar
just Comment