Last active
July 15, 2021 05:06
-
-
Save betaprojects/3d595f233d20c2e4ee713782f25aa06b to your computer and use it in GitHub Desktop.
Project Euler & HackerRank problem 47 solution: Find the first four consecutive integers to have four distinct prime factors.
This file contains 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
L, K = map(int, input().split()) | |
L+= K | |
f=[0]*L | |
for i in range(2,L): | |
if f[i] == K: | |
c +=1 | |
if c == K: | |
print (i-K+1) | |
c -= 1 | |
else: | |
c = 0 | |
if f[i]==0: f[i::i] = [x+1 for x in f[i::i]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment