





from __future__ import annotations

from collections.abc import Sequence
from typing import Literal

def   a_    ( lowerCAmelCase_      :			str,	lowerCAmelCase_      :			str	):
   __lowerCAmelCase								=	list(lowerCAmelCase_	)
   __lowerCAmelCase								=	list(lowerCAmelCase_	)
   __lowerCAmelCase								=	0
   for i in range(len(lowerCAmelCase_	)	):
      if lista[i] != lista[i]:
         count += 1
         __lowerCAmelCase								=	'_'
   if count > 1:
      return False
   else:
      return "".join(lowerCAmelCase_	)

def   a_    ( lowerCAmelCase_      :			list[str]	):
   __lowerCAmelCase								=	[]
   while True:
      __lowerCAmelCase								=	['$'] * len(lowerCAmelCase_	)
      __lowerCAmelCase								=	[]
      for i in range(len(lowerCAmelCase_	)	):
         for j in range(i + 1,	len(lowerCAmelCase_	)	):
            __lowerCAmelCase								=	compare_string(binary[i],	binary[j]	)
            if k is False:
               __lowerCAmelCase								=	'*'
               __lowerCAmelCase								=	'*'
               temp.append('X'	)
      for i in range(len(lowerCAmelCase_	)	):
         if checka[i] == "$":
            pi.append(binary[i]	)
      if len(lowerCAmelCase_	) == 0:
         return pi
      __lowerCAmelCase								=	list(set(lowerCAmelCase_	)	)

def   a_    ( lowerCAmelCase_      :			int,	lowerCAmelCase_      :			Sequence[float]	):
   __lowerCAmelCase								=	[]
   for minterm in minterms:
      __lowerCAmelCase								=	''
      for _ in range(lowerCAmelCase_	):
         __lowerCAmelCase								=	str(minterm % 2	) + string
         minterm //= 2
      temp.append(lowerCAmelCase_	)
   return temp

def   a_    ( lowerCAmelCase_      :			str,	lowerCAmelCase_      :			str,	lowerCAmelCase_      :			int	):
   __lowerCAmelCase								=	list(lowerCAmelCase_	)
   __lowerCAmelCase								=	list(lowerCAmelCase_	)
   __lowerCAmelCase								=	0
   for i in range(len(lowerCAmelCase_	)	):
      if lista[i] != lista[i]:
         count_n += 1
   return count_n == count

def   a_    ( lowerCAmelCase_      :			list[list[int]],	lowerCAmelCase_      :			list[str]	):
   __lowerCAmelCase								=	[]
   __lowerCAmelCase								=	[0] * len(lowerCAmelCase_	)
   for i in range(len(chart[0]	)	):
      __lowerCAmelCase								=	0
      __lowerCAmelCase								=	-1
      for j in range(len(lowerCAmelCase_	)	):
         if chart[j][i] == 1:
            count += 1
            __lowerCAmelCase								=	j
      if count == 1:
         __lowerCAmelCase								=	1
   for i in range(len(lowerCAmelCase_	)	):
      if select[i] == 1:
         for j in range(len(chart[0]	)	):
            if chart[i][j] == 1:
               for k in range(len(lowerCAmelCase_	)	):
                  __lowerCAmelCase								=	0
         temp.append(prime_implicants[i]	)
   while True:
      __lowerCAmelCase								=	0
      __lowerCAmelCase								=	-1
      __lowerCAmelCase								=	0
      for i in range(len(lowerCAmelCase_	)	):
         __lowerCAmelCase								=	chart[i].count(1	)
         if count_n > max_n:
            __lowerCAmelCase								=	count_n
            __lowerCAmelCase								=	i

      if max_n == 0:
         return temp

      temp.append(prime_implicants[rem]	)

      for i in range(len(chart[0]	)	):
         if chart[rem][i] == 1:
            for j in range(len(lowerCAmelCase_	)	):
               __lowerCAmelCase								=	0

def   a_    ( lowerCAmelCase_      :			list[str],	lowerCAmelCase_      :			list[str]	):
   __lowerCAmelCase								=	[[0 for x in range(len(lowerCAmelCase_	)	)] for x in range(len(lowerCAmelCase_	)	)]
   for i in range(len(lowerCAmelCase_	)	):
      __lowerCAmelCase								=	prime_implicants[i].count('_'	)
      for j in range(len(lowerCAmelCase_	)	):
         if is_for_table(prime_implicants[i],	binary[j],	lowerCAmelCase_	):
            __lowerCAmelCase								=	1

   return chart

def   a_    ( ):
   __lowerCAmelCase								=	int(input('Enter the no. of variables\n'	)	)
   __lowerCAmelCase								=	[
       float(lowerCAmelCase_	)
       for x in input(
           'Enter the decimal representation of Minterms \'Spaces Separated\'\n'	).split()
   ]
   __lowerCAmelCase								=	decimal_to_binary(lowerCAmelCase_,	lowerCAmelCase_	)

   __lowerCAmelCase								=	check(lowerCAmelCase_	)
   print('Prime Implicants are:'	)
   print(lowerCAmelCase_	)
   __lowerCAmelCase								=	prime_implicant_chart(lowerCAmelCase_,	lowerCAmelCase_	)

   __lowerCAmelCase								=	selection(lowerCAmelCase_,	lowerCAmelCase_	)
   print('Essential Prime Implicants are:'	)
   print(lowerCAmelCase_	)


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()








def   a_    ( lowerCAmelCase_      :			int	):

   if p < 2:
      raise ValueError('p should not be less than 2!'	)
   elif p == 2:
      return True

   __lowerCAmelCase								=	4
   __lowerCAmelCase								=	(1 << p) - 1
   for _ in range(p - 2	):
      __lowerCAmelCase								=	((s * s) - 2) % m
   return s == 0


if __name__ == "__main__":
     print(lucas_lehmer_test(7))
     print(lucas_lehmer_test(11))

