| 1 | # Function to cheek if number is Blum Integer |
| 2 | def isBlumInteger(n): |
| 3 | |
| 4 | prime = [True]*(n + 1) |
| 5 | |
| 6 | # to store prime numbers from 2 to n |
| 7 | i = 2 |
| 8 | while (i * i <= n): |
| 9 | |
| 10 | if (prime[i] == True) : |
| 11 | |
| 12 | # Update all multiples of p |
| 13 | for j in range(i * 2, n + 1, i): |
| 14 | prime[j] = False |
| 15 | i = i + 1 |
| 16 | |
| 17 | # to check if the given odd integer is Blum Integer or not |
| 18 | for i in range(2, n + 1) : |
| 19 | if (prime[i]) : |
| 20 | |
| 21 | # checking the factors are of 4t+3 form or not |
| 22 | if ((n % i == 0) and |
| 23 | ((i - 3) % 4) == 0): |
| 24 | q = int(n / i) |
| 25 | return (q != i and prime[q] |
| 26 | and (q - 3) % 4 == 0) |
| 27 | |
| 28 | return False |
| 29 | |
| 30 | n = int(input()) |
| 31 | if (isBlumInteger(n)): |