def factors(n, p=primes(100)): arr = [] if n == 1: return arr else: i = 0 while p[i] <= n: while n % p[i] == 0: n /= p[i] if len(arr) == 0 or len(arr) != 0 and arr[len(arr) - 1] != p[i]: arr.append(p[i]) if n == 1: break else: i += 1 return arr
import math from useful_routines import primes, isPrime, numDigits, isPandigital p = primes(100000) size = len(p) for i in range(0,size): if isPandigital(p[i]): print(i, p[i]) print(isPrime(7652413))
import math from useful_routines import primes p = primes(1000001) print(p) a = 1546346236 def sort_digits(a): s = str(a) arr = [] for i in range(0, len(s)): arr.append(int(s[i])) arr.sort() return arr max = 10000 for i in range(1, max): arr = sort_digits(i) val = True for j in range(2, 7): if sort_digits(j * i) != arr: val = False break if val:
import math from useful_routines import primes, isPrime, numDigits, isPandigital, isPalindrome max = 1000000 p = primes(max) def factors(n, p=primes(100)): arr = [] if n == 1: return arr else: i = 0 while p[i] <= n: while n % p[i] == 0: n /= p[i] if len(arr) == 0 or len(arr) != 0 and arr[len(arr) - 1] != p[i]: arr.append(p[i]) if n == 1: break else: i += 1 return arr