Рет қаралды 14,536
The Math behind: • 73939133 - Probably th...
PyMath Playlist: • PyMath
Today we code a program that spits out a list of all possible right truncatable Prime Numbers and thus, also the biggest one in existence 73939133. Truncatable primes are numbers, such that you can take the last digit off and still receive a prime number again :)
This video is part of the MegaFavNumbers project. Maths KZbinrs have come together to make videos about their favourite numbers bigger than one million, which we are calling #MegaFavNumbers.
We want you, yes you humble viewer, to join in! Make your own video about your favourite mega-number. You can think of a cool big number, or think of a cool topic first and hang a mega-number on it. Upload your videos to KZbin with the hashtag #MegaFavNumbers and with MegaFavNumbers in the title, and your video will be added to the megafavnumbers playlist.
Submit your videos anytime before Wednesday 2nd September to be added to the MegaFavNumbers playlist! MegaFavNumbers Playlist: • MegaFavNumbers
Python Code:
import math
def primalitytest(y):
for i in range(2, math.floor(math.sqrt(int(y)))+1):
if (int(y) % i) == 0:
break
else:
return y
def trunc(x):
trunclist = ['2','3','5','7']
trunclistnew = ['2','3','5','7']
appendlist = ['1','3','7','9']
trigger = True
while trigger == True:
trigger= False
length=len(trunclist)
for i in range(0, len(trunclist)):
for j in range(0, len(appendlist)):
primecand = trunclist[i]+appendlist[j]
for t in range(2, math.floor(math.sqrt(int(primecand)))+1):
if (int(primecand) % t) == 0:
break
else:
trunclistnew.append(primecand)
trunclist.append(primecand)
for i in range(0,length):
trunclist.pop(0)
trigger = True
if len(trunclist)==0:
biggest = trunclistnew[len(trunclistnew)-1]
print('The biggest truncatable prime number is',str(biggest)+'.')
trigger = False
print('')
print('The list of all right truncatable primes is: ')
return(trunclistnew)
a = input('You sure u wanna see the biggest niBBa? ')
print('')
print(trunc(a))
Help me create more free content! =)
/ mathable
Merch :v - papaflammy.myt...
www.amazon.com...
shop.spreadshi...
Become a Member of the Flammily! :0 / @papaflammy69
2nd Channel: / @npcooking69
--------------------------------------------------------------------------------
Wanna send me some stuff? lel:
Postfach 11 15
06731 Bitterfeld-Wolfen
Saxony-Anhalt
Germany
--------------------------------------------------------------------------------
My Website: papaflammy.eng...
Instagram: / uncomfortably_cursed_m...
Flammy's subreddit: / flammybois
Twitter: / flammablemaths
Facebook: / flammablemaths
Got some time to spare? Make sure to add captions to my videos! =) www.youtube.com...
Want to know more about me? Watch my QnA! =D • Question and Answer Ti...