Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def countdoubleoccurrances(n,d):
- count=0
- while (n>0):
- if(n%10==d):
- count+=1
- if(count>2):
- return -1
- n=n//10
- return count
- def magicsquare(n):
- for i in range(0,9):
- if(countdoubleoccurrances(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
Add Comment
Please, Sign In to add comment