Phython

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Python program to check if the input number is prime or not

num = 357357573335577735575753575

# take input from the user
# num = int(input("Enter a number: "))

# prime numbers are greater than 1
if num > 1:
   # check for factors
   for i in range(2,num):
       if (num % i) == 0:
           print(num,"is not a prime number")
           print(i,"times",num//i,"is",num)
           break
   else:
       print(num,"is a prime number")

# if input number is less than
# or equal to 1, it is not prime
else:
   print(num,"is not a prime number")

True or false:

Above shows a python program. The output of the program is:

357357573335577735575753575 is a prime number.

True False

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

B D
Sep 1, 2018

Put the code into brilliant's coding environment(click the globe(up, right) scroll down and click the button).

Hasmik Garyaka
Oct 25, 2017

Very unefficent. for i in range(2,int(math.sqrt(num))):

for i in range(2,int(math.sqrt(num))):

This gives an error!

Munem Shahriar - 3 years, 7 months ago

Log in to reply

import math

Hasmik Garyaka - 3 years, 7 months ago
Bla Blub
Oct 25, 2017

357357573335577735575753575 is not a prime number. 5 times 71471514667115547115150715 is 357357573335577735575753575.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...