Skip to content

Instantly share code, notes, and snippets.

@ankitmishra88
Last active April 5, 2020 10:18
Show Gist options
  • Save ankitmishra88/f9b22d70d748adf3335cde028b232dbb to your computer and use it in GitHub Desktop.
Save ankitmishra88/f9b22d70d748adf3335cde028b232dbb to your computer and use it in GitHub Desktop.
#-------pi(r^2)=(n!)^2
import math
fact=[1]
#----------Preprocessing---------------#
def preprocess():
for i in range(100000):
fact.append((fact[i]*(i+1))%1000000007)
def main():
preprocess()
t=int(input())
for i in range(t):
n=int(input())
n=int(math.sqrt(n))
ans=(fact[n]**2)%1000000007
print(ans)
if __name__=="__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment