Skip to content

Commit 488fa21

Browse files
fix clang-format issues
1 parent 0c85933 commit 488fa21

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,34 @@
1-
public final class SquareFreeInteger{
1+
package com.thealgorithms.maths;
22

33
/**
4-
* A square-free integer is an integer divisible by no perfect square other than 1
4+
* A square-free integer is an integer divisible by no perfect square other than 1
55
* In other words, its prime factorization has no repeated factors.
66
* Examples: 1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15...
77
* Non-examples: 4, 8, 9, 12, 16, 18 (all divisible by 4 or 9)
8-
*
8+
*
99
* @see <a href="https://en.wikipedia.org/wiki/Square-free_integer">Square-free integer (Wikipedia)</a>
1010
*/
11+
public final class SquareFreeInteger {
1112

12-
private SquareFreeInteger(){
13-
13+
private SquareFreeInteger() {
1414
}
1515

1616
/**
1717
* Checks if a given number is square-free.
18-
*
19-
* @param num the number to check(this must be positive)
20-
* @return true if num is square-free , false otherwise
18+
*
19+
* @param num the number to check (this must be positive)
20+
* @return true if num is square-free, false otherwise
2121
* @throws IllegalArgumentException if num is not positive
22-
*
2322
*/
24-
public static boolean isSquareFree(int num){
25-
if(num<=0){
23+
public static boolean isSquareFree(int num) {
24+
if (num <= 0) {
2625
throw new IllegalArgumentException("Input must be a positive integer.");
2726
}
28-
29-
for(int i=2; (long)i*i<=num ;i++){
30-
if(num%(i*i)==0){
27+
for (int i = 2; (long) i * i <= num; i++) {
28+
if (num % (i * i) == 0) {
3129
return false;
3230
}
3331
}
3432
return true;
35-
36-
3733
}
3834
}

0 commit comments

Comments
 (0)