#K5786. Square-Free Number Checker
Square-Free Number Checker
Square-Free Number Checker
Given a positive integer \(n\), determine whether it is a square-free number. A number is square-free if it is not divisible by any perfect square greater than 1. In other words, for every integer \(i \ge 2\), \(i^2\) should not divide \(n\).
For example:
- \(15\) is square-free since no square number (other than 1) divides it.
- \(18\) is not square-free because \(9 = 3^2\) divides it.
- \(1\) is considered square-free by definition.
Your task is to implement a program that reads an integer from standard input and prints True
if the number is square-free, otherwise prints False
. Use appropriate algorithms to ensure efficiency even for large inputs.
inputFormat
The input consists of a single integer \(n\) (\(1 \le n \le 10^9\)) provided via standard input.
outputFormat
Output a single line containing either True
if \(n\) is a square-free number, or False
otherwise.
15
True