Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def countoccurrances(n, d):
- count = 0
- while (n > 0):
- if(n % 10 == d):
- count = +=1
- n = n // 10
- return count
- def magicsquare(n):
- for i in range(0,9):
- if(countoccurrances(n*n,i)!=2):
- return False
- return True
- i=1
- for n in range(3164211346,9994386752):
- if(magicsquare(n)):
- string=str(i)+" "+str(n)+" "+str(n*n)
- print(string)
- i+=1
Advertisement
Add Comment
Please, Sign In to add comment