## Wednesday, September 27, 2017

### Pi Digits High Low Game

Suppose you take a long number and for each digit if it is bigger then the previous one increase a counter by one. If it is less then the previous number reduce the counter by one. You keep a running total and graph that total. Noting when it passes 0. This total number will go up and down and can get to zero many times. If you play this game with random numbers in a million digits on average the number of times you will have crossed 0 is 1594.4 and the standard deviation of the number of times crossed 0 is 1207.3. Though as the number of times zero is crossed cannot be less then 0 this is a bit odd.
```       ```
import random

numcrossed=[]
j=0
while j < 200:
i = 0
last=0
total=0
x=[]
y=[]
crossed=0
while i < 1000000:
ran= random.randint(0, 10)
if ran==last:
total=total
elif ran>last:
total=total+1
else:
total=total-1
if total==0:
x.append(i)
y.append(total)
crossed=crossed+1
i=i+1
last=ran
numcrossed.append(crossed)
j=j+1
```
```
If instead of random numbers the digits of pi are used. This is what the path of total counts looks like
```       ```
file = open("pi1000000.txt", "r")
#3.14159265358979323846264338327950 pi2.txt
x = []
y = []

pi = list(text)
total =0
i = 0
crossed=0
i=0

while i < len(pi):
if pi[i]>pi[i-1]:
#print(pi[i])
total=total+1
if pi[i]
``````
``` Pi has a 0 total 657 times. Which is more than 51 out of 200 random million long sequences did in my tests. None of this means anything. Going up or down based on digits in a base ten number but i like these pattern sort of sequences. E crosses 0 1725 times sqrt2 crosses 0 1300 times and with 2 million digits The python code for visualisation is import numpy as np import matplotlib.pyplot as plt plt.scatter(x, y, alpha=0.5, color='green') plt.title('Sqrt 2 High Low Game') plt.show() ```
``` Posted by David Curran at 1:18 PM Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: math, Maths, python ```
``` No comments: Post a Comment ```
``` ```
``` ```
``` Newer Post Older Post Home Subscribe to: Post Comments (Atom) window.___gcfg = { 'lang': 'en' }; ```
``` ```
``` ```
``` if (typeof Meebo == 'undefined') { Meebo=function(){(Meebo._=Meebo._||[]).push(arguments)}; (function(q){ var d=document,b=d.body; if(!b){var cb=arguments.callee;return setTimeout(function(){cb(q)},100);} var m=b.insertBefore(d.createElement('div'), b.firstChild), s=d.createElement('script'); m.id='meebo'; m.style.display='none'; m.innerHTML='<iframe id="meebo-iframe" frameBorder="0" ></iframe>'; s.src='http'+(q.https?'s':'')+'://'+(q.stage?'stage-':'')+'cim.meebo.com/cim/cim.php?network='+q.network; d.getElementsByTagName('head')[0].appendChild(s); })({network: 'liveatthewitchtrials_hu21qi', stage: false}); Meebo('makeEverythingSharable'); } Labels screwing the inscrutable (90) Funny Ha Ha (85) Science (69) economics (68) Maths (53) prediction (49) Rant (44) Prediction markets (21) Geek (20) security (19) progress (17) review (16) business plan (13) law (12) glpk (10) Homemade ventilator (8) hacking (8) quiz (8) Ruby (7) lottery (6) Long Now (5) PPX (5) analyticsx (4) collison (4) Rubik's (3) About Me David Curran View my complete profile Stuff Beer + Knitting Real Wealth A World Wide Web of Electricity Our Friends Electric Gruntled Ginno megalithomania Watson Tricks Blog Archive ►  2019 (2) ►  January (2) ►  2018 (1) ►  January (1) ▼  2017 (18) ►  December (1) ►  October (6) ▼  September (3) Making Turtle pictures with Numbers made from Numb... Random Walks with Number Digits Pi Digits High Low Game ►  April (3) ►  January (5) ►  2016 (8) ►  June (1) ►  May (2) ►  April (1) ►  March (1) ►  January (3) ►  2015 (30) ►  December (1) ►  November (5) ►  October (5) ►  September (3) ►  June (1) ►  May (2) ►  April (5) ►  March (3) ►  February (5) ►  2014 (9) ►  November (4) ►  October (1) ►  August (1) ►  June (1) ►  March (1) ►  January (1) ►  2013 (1) ►  November (1) ►  2012 (31) ►  December (6) ►  November (4) ►  October (1) ►  September (2) ►  August (1) ►  July (2) ►  June (2) ►  May (2) ►  April (3) ►  March (1) ►  February (2) ►  January (5) ►  2011 (39) ►  December (7) ►  November (6) ►  October (1) ►  September (1) ►  August (6) ►  July (1) ►  June (6) ►  May (2) ►  March (3) ►  February (5) ►  January (1) ►  2010 (28) ►  December (1) ►  November (1) ►  October (3) ►  September (7) ►  August (1) ►  July (3) ►  June (1) ►  May (3) ►  March (4) ►  February (1) ►  January (3) ►  2009 (43) ►  December (1) ►  November (4) ►  October (4) ►  September (4) ►  August (1) ►  July (1) ►  June (3) ►  May (2) ►  April (7) ►  March (5) ►  February (7) ►  January (4) ►  2008 (78) ►  December (3) ►  November (6) ►  October (2) ►  September (1) ►  August (1) ►  July (5) ►  June (6) ►  May (7) ►  April (10) ►  March (13) ►  February (12) ►  January (12) ►  2007 (112) ►  December (6) ►  November (9) ►  October (6) ►  August (5) ►  July (4) ►  June (16) ►  May (26) ►  April (8) ►  March (12) ►  February (13) ►  January (7) ►  2006 (32) ►  December (5) ►  November (22) ►  October (5) ```
``` ```
``` ```
``` ```
``` ```
``` Simple theme. Powered by Blogger. ```
``` ```
``` ```
``` ```
``` window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); window['__wavt'] = 'AOuZoY7Ri-STtiaqhapHpdgBA_8_4v9cUw:1548034364295';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d36234687','//liveatthewitchtrials.blogspot.com/2017/09/pi-digits-high-low-game.html','36234687'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '36234687', 'title': 'Live at the Witch Trials', 'url': 'http://liveatthewitchtrials.blogspot.com/2017/09/pi-digits-high-low-game.html', 'canonicalUrl': 'http://liveatthewitchtrials.blogspot.com/2017/09/pi-digits-high-low-game.html', 'homepageUrl': 'http://liveatthewitchtrials.blogspot.com/', 'searchUrl': 'http://liveatthewitchtrials.blogspot.com/search', 'canonicalHomepageUrl': 'http://liveatthewitchtrials.blogspot.com/', 'blogspotFaviconUrl': 'http://liveatthewitchtrials.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en', 'localeUnderscoreDelimited': 'en', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Live at the Witch Trials - Atom\x22 href\x3d\x22http://liveatthewitchtrials.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Live at the Witch Trials - RSS\x22 href\x3d\x22http://liveatthewitchtrials.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Live at the Witch Trials - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/36234687/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Live at the Witch Trials - Atom\x22 href\x3d\x22http://liveatthewitchtrials.blogspot.com/feeds/7898286762063189942/comments/default\x22 /\x3e\n', 'meTag': '', 'googleProfileUrl': 'https://plus.google.com/103661487524425808039', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'ieCssRetrofitLinks': '\x3c!--[if IE]\x3e\x3cscript type\x3d\x22text/javascript\x22 src\x3d\x22https://www.blogger.com/static/v1/jsbin/864213505-ieretrofit.js\x22\x3e\x3c/script\x3e\n\x3c![endif]--\x3e', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/15212a1712486a03', 'plusOneApiSrc': 'https://apis.google.com/js/plusone.js', 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'Twitter', 'key': 'twitter', 'shareMessage': 'Share to Twitter', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Google+', 'key': 'googlePlus', 'shareMessage': 'Share to Google+', 'target': 'googleplus'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': false, 'googlePlusShareButtonWidth': 300, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '7898286762063189942', 'postImageThumbnailUrl': 'https://3.bp.blogspot.com/-TekhAYBnANs/Wcu4c9u-wLI/AAAAAAAAVY8/_NJcVTMlcz4Em1zVynOs5n3lMGAxPyjkwCLcBGAs/s72-c/pihigh.png', 'postImageUrl': 'https://3.bp.blogspot.com/-TekhAYBnANs/Wcu4c9u-wLI/AAAAAAAAVY8/_NJcVTMlcz4Em1zVynOs5n3lMGAxPyjkwCLcBGAs/s640/pihigh.png', 'pageName': 'Pi Digits High Low Game', 'pageTitle': 'Live at the Witch Trials: Pi Digits High Low Game'}}, {'name': 'features', 'data': {'sharing_get_link_dialog': 'true', 'sharing_native': 'false'}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard!', 'ok': 'Ok', 'postLink': 'Post Link'}}, {'name': 'template', 'data': {'name': 'Simple', 'localizedName': 'Simple', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': false, 'variant': 'pale', 'variantId': 'pale'}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'Pi Digits High Low Game', 'description': 'Suppose you take a long number and for each digit if it is bigger then the previous one increase a counter by one. If it is less then the pr...', 'featuredImage': 'https://3.bp.blogspot.com/-TekhAYBnANs/Wcu4c9u-wLI/AAAAAAAAVY8/_NJcVTMlcz4Em1zVynOs5n3lMGAxPyjkwCLcBGAs/s640/pihigh.png', 'url': 'http://liveatthewitchtrials.blogspot.com/2017/09/pi-digits-high-low-game.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 7898286762063189942}}]); _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/3811023861-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/368954415-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'sidebar-right-1', document.getElementById('HTML1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LabelView', new _WidgetInfo('Label1', 'sidebar-right-1', document.getElementById('Label1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_ProfileView', new _WidgetInfo('Profile1', 'sidebar-right-2-1', document.getElementById('Profile1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_LinkListView', new _WidgetInfo('LinkList1', 'sidebar-right-2-2', document.getElementById('LinkList1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar-right-3', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer-3', document.getElementById('Attribution1'), {}, 'displayModeFull')); ```