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
PyAbs
EJ2_PYTHON_20.321.212-7
Fiboncaci series in recursion
Hr
Game2
T
134
10
Lesson 8 updated
PYTHON 3