MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / isBlumInteger

Function isBlumInteger

GeeksForGeeks/Blum Integer/solution.py:2–28  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1# Function to cheek if number is Blum Integer
2def 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
30n = int(input())
31if (isBlumInteger(n)):

Callers 1

solution.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected