These fields are all optional and need only
be supplied if you would like a direct reply.
Subject
Your email address
Your real name
You must answer this!
If you don't, my spam filtering will
ensure that I never see your email.
What's 8 plus five (in digits only)?
Please make your changes here and then
Editing tips and layout rules.
File: LeftTruncatablePrime ''' <link rel="alternate" type="application/rss+xml" ''' href="/rss.xml" title="RSS Feed"> ********> width="25%" |>> ''' <a title="Subscribe to my feed" ''' rel="alternate" ''' href="https://www.solipsys.co.uk/rss.xml"> ''' <img style="border-width: 0px;" ''' src="https://www.feedburner.com/fb/images/pub/feed-icon32x32.png" ''' align="middle" ''' alt="" />Subscribe!</a> _ ''' <a href="https://twitter.com/ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/new/images/TwitterButton.png" ''' title="By: TwitterButtons.net" ''' width="212" height="69" ''' alt="@ColinTheMathmo" ''' /></a> <<| ---- My latest posts can be found here: * ColinsBlog ---- Previous blog posts: * TheDoctorAndTheLawyer * FourPointsTwoDistancesProof * MeetingRonGraham * NapkinRingVersusSphericalCap * TheFourPointsPuzzle * RadiusOfTheEarthPartTwo * GrepTimingAnomaly * TheRadiusOfTheEarth * ThisWorksToCureMyHiccoughs * PerhapsWeSavedOne * ThinkingAboutMastodon * DisappearingTrainsOnVirgin * TheIndependenceGame * OneOfMyFavouritePuzzles * ThinkingAboutRecursion * MemorisingTheTube * SpikeySpheres * SurprisinglyQuick * AnUnexpectedFraction * YouHaveToAdmireTheirOptimism * RepresentativesMatter * PythagorasByIncircle * APuzzleAboutPuzzles * HowNotToDoTwitter * Calculating52FactorialByHand * SmallThingsMightNotBeSoSmall * NotIfYouHurry * FactoringViaGraphThreeColouring * AnotherProofOfTheDoodleTheorem * WhenObviousIsNotObvious * GraphThreeColouring * TheDoodleTheorem * BeCarefulWhatYouSay * TheMutilatedChessboardRevisited * AMirrorCopied * TheOtherOtherRopeAroundTheEarth * PhotocopyAMirror * ThePointOfTheBanachTarskiTheorem * SieveOfEratosthenesInPython * FastPerrinTest * RussianPeasantMultiplication * FindingPerrinPseudoPrimes_Part2 * FindingPerrinPseudoPrimes_Part1 * TheUnwiseUpdate * MilesPerGallon * TrackingAnItemOnHackerNews * HackerNewsUserAges * PokingTheDustyCorners * ThereIsNoTimeForThis * PublicallySharingLinks * LearningTimesTables * GracefulDegradation * DiagrammingMathsTopics * OnTheRack * SquareRootByLongDivision * BeyondTheBoundary * FillInTheGaps * SoftwareChecklist * NASASpaceCrews * TheBirthdayParadox * TheTrapeziumConundrum * RevisitingTheAnt * TheAntAndTheRubberBand * IrrationalsExist * MultipleChoiceProbabilityPuzzle * RandomEratosthenes * WrappingUpSquareDissection * DissectingASquarePart2 * DissectingACircle * DissectingASquare * AnOddityInTennis * DecisionTreeForTennis * DecisionTreesInGames * AMatterOfConvention * DoYouNourishOrTarnish * BinarySearchReconsidered * TwoEqualsFour * TheLostPropertyOffice * TheForgivingUserInterface * SettingUpRSS * WithdrawingFromHackerNews ---- Additionally, some earlier writings: * RandomWritings. * ColinsBlog2010 * ColinsBlog2009 * ColinsBlog2008 * ColinsBlog2007 * ColinsBlogBefore2007 ******** !! 2017/10/21 - Left Truncatable Prime Recently MathsInspiration produced some pencils with a fantastic idea. Yes, their name is on it: |>> [[[ https://www.solipsys.co.uk/images/MathsInspirationPencil.jpg ]]] <<| Yes, it has a slightly cheesy catch-phrase: |>> [[[ https://www.solipsys.co.uk/images/MathsInspirationPencil_Logo.jpg ]]] <<| But then there is something really clever. [[[>50 I've had some more information about this, and the true story[0] is even better than I thought. Apparently the actual text was "Too Cool to do Drugs" - so that was: * *TOO*COOL*TO*DO*DRUGS* * then: *COOL*TO*DO*DRUGS* * and then we get: *DO*DRUGS* Someone has even done a remake of the pencil[1]. My thanks to Stratoscope[2] for the comment[3] on Hacker News[4]. ]]] There was a beautiful and now classic example of a marketing fail when someone produced a pencil with the logo "DON'T DO DRUGS". But as the pencil was sharpened the logo was gradually reduced, firstly to the direct exhortation "DO DRUGS" and then finally the simple, dramatic, "DRUGS". Similarly, then, the prime printed on the MathsInspiration pencil will, of course, be reduced from the left as the pencil is used and sharpened, but a wonderful thing happens. As the digits are removed from the left, the number that remains is still prime. |>> [[[ https://www.solipsys.co.uk/images/MathsInspirationPencil_Prime.jpg ]]] <<| It's a left-truncatable prime, which is "A Thing" and you can look it up on the web, but I thought I'd write a quick program to check the one given on the pencil (yes, it's prime), and to see if there was a longer one. There isn't. Here's my code. It's intended to be clear rather than clever, but do feel free to tell me what I've got wrong. [[[>30 Nice challenge: Find a false positive from this prime testing routine. ]]] {{{ #!/usr/bin/python from math import log small_primes = [ 2, 3, 5, 7, \ 11, 13, 17, \ 19, 23, 29, ] def is_prime( n ): if n in small_primes: return True if n < small_primes[-1]: return False for p in small_primes: if pow(p,n-1,n)!=1: return False return True limit = 10 prospects = range(2,limit) prospects = [ x for x in prospects if is_prime(x) ] while prospects: p2 = [] for t in range(1,10): p2 += [ t*limit+x for x in prospects \ if is_prime( t*limit+x ) ] prospects = p2 limit *= 10 print log(limit)/log(10), len(prospects), prospects }}} Lovely thing. ---- !! References: * [0] http://www.nytimes.com/1998/12/12/nyregion/slogan-causes-pencil-recall.html * [1] http://shop.brrybnds.com/product/cool-to-do-drugs-pencil * [2] https://news.ycombinator.com/user?id=Stratoscope * [3] https://news.ycombinator.com/item?id=15523000 * [4] https://news.ycombinator.com/ ---- |>> | |>> <<<< Prev <<<< ---- TheDoctorAndTheLawyer <<| | : | |>> >>>> Next >>>> ---- NotASpectatorSport ... <<| | ---- ********> ''' <a href="https://mathstodon.xyz/@ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/images/Mastodon_Mascot.png" ''' width="256" height="280" ''' alt="https://mathstodon.xyz/@ColinTheMathmo" ''' /></a> ******** ''' <a href="https://mathstodon.xyz/@ColinTheMathmo/">You can follow me on Mathstodon.</a> _ _ _ _ [[[> ''' <a href="https://twitter.com/ColinTheMathmo">Of course, you can also<br>follow me on twitter:</a> ''' <a href="https://twitter.com/ColinTheMathmo"> ''' <img src="https://www.solipsys.co.uk/new/images/TwitterButton.png" ''' title="By: TwitterButtons.net" ''' width="212" height="69" ''' alt="@ColinTheMathmo" ''' /></a> ''' <img src="/cgi-bin/CountHits.py?LeftTruncatablePrime" alt="" /> ]]] ********< ---- !! Send us a comment ... ''' <form action="https://www.solipsys.co.uk/cgi-bin/FormMail.pl" method=post> ''' <input type=hidden name="recipient" value="colinsblogcomment@solipsys.co.uk" > ''' <input type=hidden name="subject" value="Blog comment : LeftTruncatablePrime" > ''' <input type=hidden name="redirect" value="https://www.solipsys.co.uk/new/ThankYouForYourComment.html" > ''' <input type=hidden name="missing_fields_redirect" value="https://www.solipsys.co.uk/RequestError.html"> ''' <input type=hidden name="env_report" value="REMOTE_HOST, REMOTE_ADDR, HTTP_USER_AGENT" > ''' <input type=hidden name="print_blank_fields" value="1" > ********> width="47%" You can send us a message here. It doesn't get published, it just sends us an email, and is an easy way to ask any questions, or make any comments, without having to send a separate email. So just fill in the boxes and then ''' <font size="+4"><INPUT TYPE="submit" VALUE="CLICK HERE TO SEND"></font> ******** width="53%" ********< ''' <table cellpadding="5"> ''' <tr> ''' <td valign="top">Your name </td> <td valign="top">:</td> ''' <td> <input type=text name="realname" size="48"> </td> ''' <tr> ''' <td valign="top">Email </td> <td valign="top">:</td> ''' <td> <input type=text name="email" size="48"> </td> ''' </tr> ''' <tr> ''' <td valign="top">Message </td> <td valign="top">:</td> ''' <td> <TEXTAREA NAME="Message" ROWS=10 COLS=64></TEXTAREA> </td> ''' </tr> ''' </table> ''' <center> ''' <font size="+4"> ''' <INPUT TYPE="submit" VALUE="CLICK HERE TO SEND"> ''' </font> ''' </center> ''' </form> ********<