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 #130: Composites with prime repunit property

Project Euler #130: Composites with prime repunit property

Problem
Submissions
Leaderboard
Discussions

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

A number consisting entirely of ones is called a repunit. We shall define to be a repunit of length ; for example, .

Given that is a positive integer and , it can be shown that there always exists a value, , for which is divisible by , and let be the least such value of ; for example, and .

You are given that for all primes, , that is divisible by . For example, when , , and is divisible by .

However, there are rare composite values for which this is also true; the first five examples being , , , , and .

Given and , print all composite values in the interval for which and is divisible by .

Input Format

The input contains consists of one line containing two integers and separated by a space.

Constraints


In files #01-#05:
In files #06-#10:
In files #11-#25:

Output Format

Output all composite values in the interval for which and is divisible by , each in a single line.

Sample Input

2 1000

Sample Output

91
259
451
481
703

Explanation

and 90 is divisible by 6.

Author

kevinsogo

Difficulty

Easy

Max Score

100

Submitted By

225

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy