def number_of_digits():
number = int(input('Enter number of digits: '))
return number
def entering_numbers(number):
counter = 1
numbers = []
while True:
if counter <= number:
digit = int(input('Enter sequence number: '))
numbers.append(digit)
else:
break
counter += 1
return numbers
def find_prime(subsequence):
i, j, flag = 0, 0, 0
for i in subsequence:
if (i == 1 or i == 0):
continue
flag = 1
for j in range(2, ((i // 2) + 1), 1):
if (i % j == 0):
flag = 0
if (flag == 1):
print('First prime: ', i)
break
def main():
number = number_of_digits()
subsequence = entering_numbers(number)
find_prime(subsequence)
if __name__ == "__main__":
main()
Comments
Leave a comment