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 #193: Squarefree Numbers

Project Euler #193: Squarefree Numbers

Problem
Submissions
Leaderboard
Discussions

A positive integer is called squarefree, if no square of a prime divides , thus are squarefree, but not .

Similarly, let us define a positive integer to be powerfree if no power of a prime divides . For example, is powerfree, but not .

You are given two positive integers, , and . Find the number of powerfree positive integers

Input Format

The only line of the input contains two integers, , and .

Constraints

Output Format

Print one line containing the number of powerfree positive integers

Sample Input 0

10 2

Sample Output 0

7

Explanation 0

We have to find the number of -powerfree (squarefree) integers . These integers are

Sample Input 1

10 3

Sample Output 1

9

Explanation 1

All positive integers are -powerfree, except . (Since is divisible by )

Author

jtnydv25

Difficulty

Medium

Max Score

100

Submitted By

965

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