We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #47: Distinct primes factors

Project Euler #47: Distinct primes factors

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 47 from projecteuler.net

The first two consecutive numbers to have two distinct prime factors are:

The first three consecutive numbers to have three distinct prime factors are:

Given find all the consecutive integers, where first integer is to have exactly distinct prime factors. Print the first of these numbers in ascending order.

Input Format
Input contains two integers and .

Output Format
Print the answer corresponding to the test case. Print each integer in a new line.

Constraints

Sample Input#00

20 2

Sample Output#00

14
20

Sample Input#01

644 3

Sample Output

644

Author

shashank21j

Difficulty

Easy

Max Score

100

Submitted By

2568

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy