moran number python

Solutions on MaxInterview for moran number python by the best coders in the world

showing results for - "moran number python"
Marley
27 May 2016
1def total (n):
2    Sum=0
3    while n>0:
4        Sum+=n%10
5        n//=10
6    return Sum
7def prime(n):
8    k=2
9    while k*k<=n and n%k!=0:
10        k+=1
11    return k*k>n
12    if k*k>n:
13        return True
14    else:
15        return False
16def moran_num(n):
17    dup = n
18    _sum = total(n)
19    if (n % _sum == 0):
20        c = n // _sum
21        if (prime(c)):
22            print('Moran')
23            return
24    print("Non-Moran")
25            
26x=int(input('Enter a number:'))
27moran_num(x)
queries leading to this page
moran number pythonmoran number python