rotation of n prime numbers in python

Solutions on MaxInterview for rotation of n prime numbers in python by the best coders in the world

showing results for - "rotation of n prime numbers in python"
Maria José
02 Aug 2018
1def rotate(n1):
2        l=len(str(n1))
3        a=n1%10
4        n1=n1//10
5        n1=(pow(10,l-1)*a)+n1
6        return n1
7def prime(n2):
8      count=0
9      for i in range(1,n2):
10          if(n2%i==0):
11              count+=1
12          if(count>1):
13            return False
14        else:
15            return True
16l=len(str(num))
17i=1
18while(i<=l):
19    if(prime(num)):
20         num=rotate(num)
21     else:
22         return False
23     i+=1
24return True