Created
February 25, 2016 09:55
-
-
Save Sangram92/1cd58a18a5970373c87b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""find the all the possible prime number from the given integer number | |
input : 3657 | |
output : 3 5 7 37 53 67 73 367 563 653 673 | |
""" | |
import itertools | |
final_list = [] | |
num = raw_input("Enter no : ") | |
for x in range(1,len(num)+1): | |
sep_list = [int(''.join(a)) for a in list(itertools.permutations(num, x))] | |
final_list.extend(sep_list) | |
print "Generated Possible Permutation No List", "\n", final_list | |
def prime(list): | |
prime_no = [] | |
for num in list: | |
if num > 1: | |
for i in range(2,num): | |
if (num % i) == 0: | |
break | |
else: | |
prime_no.append(num) | |
print "Prime No List : ", prime_no | |
prime(final_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment