Skip to content

Instantly share code, notes, and snippets.

@betaprojects
Last active July 15, 2021 05:06
Show Gist options
  • Save betaprojects/3d595f233d20c2e4ee713782f25aa06b to your computer and use it in GitHub Desktop.
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.
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