Skip to main content

Posts

Showing posts with the label problem47

Problem 47 Project Euler Solution with python

Distinct primes factors The first two consecutive numbers to have two distinct prime factors are: 14 = 2 × 7 15 = 3 × 5 The first three consecutive numbers to have three distinct prime factors are: 644 = 2² × 7 × 23 645 = 3 × 5 × 43 646 = 2 × 17 × 19. Find the first four consecutive integers to have four distinct prime factors. What is the first of these numbers? I have written a direct solution for this problem. Solution which you can see below, uses prime factorization as the base concept. All the remaining things are simple and easy. You can see further explanation in the program section. Program   File: pep47.py ------------------------- # http://radiusofcircle.blogspot.com # time module import time # time at the start of program execution start = time.time() def npf(number): """function which will return the number of prime factors""" i = 2 a = set() while i We have created npf function an ab...