0:40 "A ressource where you can download all the digits of Pi." Wait, ALL of them? That's a very impressive website.
@speedfastman4 жыл бұрын
The technology is finally here!
@MohamedSaad-zy7pu4 жыл бұрын
pi has infinitely many digits no database ever could hold all digits of pi
@v0xl4 жыл бұрын
@@MohamedSaad-zy7pu woosh
@xnick_uy4 жыл бұрын
I can give you all the digits of pi right here in this comment: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Just rearrange and repeat some of them as you see fit to recreate pi. You are welcome. :-)
@Firestar-rm8df4 жыл бұрын
@@xnick_uy XD
@lucasschiavetti27994 жыл бұрын
Hey. I am just a random 30 yo Brazilian geologist switching carreers and I want to say that today is saturday night, world has corona, I am anxious, alone, thinking about life but this video and your work/passion/humour make things easier for me and I am sure for a lot of other people. Keep up the good work. We appreciate it.
@sombracep124 жыл бұрын
Boa Cara, muita gente de programação é de outras áreas.
@marcpietro27324 жыл бұрын
Who noticed Dan replaced so many times "million" by "billion", by deleting "million" and writing "billion" instead (or vice versa), while there is just one letter to change?
@TheCodingTrain4 жыл бұрын
🤦♂️
@elementallobsterx4 жыл бұрын
No way Dan... ALMOST 1 MILLION SUBSCRIBERS NOW!? I remember your classic P5 tutorials before the whole coding train thing even existed!! I just wanna say, I'm proud, man.
@TheCodingTrain4 жыл бұрын
Thank you!
@Kokurorokuko4 жыл бұрын
28:18 Shocking news! Man found last ten digits of PI
@luisgeniole3694 жыл бұрын
We can use the tail command in bash to find the last ten digits of pi like so: tail -c 10 pi-billion.txt
@kimeg72944 жыл бұрын
"last ten digits of KNOWN PI sequence"
@Cry53r4 жыл бұрын
@@kimeg7294 Oh... Oh no, sweet child... A billion is just the first sneeze of what has been calculated.
@ffggddss4 жыл бұрын
Bigger shock - they turned out to be . . . 9876543210. Fred
@0FG04 жыл бұрын
I am always a bit amazed at how incredibly much larger a billion is than a million. I know the math is super simple, but the intuition of it is really difficult for me to grasp
@xot98974 жыл бұрын
Morten Flecks if you look at a millimetre on a metre stick, same ratio
@shreerangvaidya92644 жыл бұрын
Look back a dozen decades when the definition of billion was a million million in England, and you will be more amazed.
@InXLsisDeo Жыл бұрын
That's why people don't realize how being a billionaire is completely unnecessary and actually detrimental to society. See it like this: if your salary was 1 million $ per month (not per year, per month), it would take 84 years (aka more than an entire working lifetime) to earn a billion $. And that would be without spending a single $ or paying any tax during all that time.
@InXLsisDeo Жыл бұрын
@@shreerangvaidya9264 no, it's a thousand million. A million million is a trillion.
@097_shashanksahu64 жыл бұрын
Do everyone will ignore the fact that , coding train will soon hit 1 million subscribers. I didn't even how when you reached too close to 1M. It had been 3-4 years now since i am watching your videos.... You taught me processing, you taught me the Nature Of code.... This channel is absolute gold.... I don't remember whats the first video i watched but i could proudly say that i had watched almost every of them. 😍 love from india Dan❤
@thomasdevelops30874 жыл бұрын
shashank Sahu he has hit 1 million as of today!
@Budzique4 жыл бұрын
Pi was calculated to 50Trillion digits, a text file is available but it's 40TB! Today it's also been added to the pi.delivery api
@bilallaaroussi71104 жыл бұрын
What is the use of this
@ffggddss4 жыл бұрын
@@bilallaaroussi7110 Esoteric. It's of some interest to mathematicians to know whether there are any non-random patterns in the digits of π, and these mammoth collections of digits can be used to answer such statistical questions. Fred
@ffggddss4 жыл бұрын
50 trillion digits in 40 trillion bytes? Must be slightly compressed, no? (Even if that's the binary terabyte = 2⁴⁰ B, 40 TB ≈ 44.0 trillion bytes.) Fred
@Xnoob5454 жыл бұрын
50T 40TB Wot
@oblivion_28524 жыл бұрын
Use it for some good random numbers
@MinisBett4 жыл бұрын
Finally another Coding Challenge! I really hope for more coding challenges, I really like these videos!
@newzenvigor2 жыл бұрын
This is my first video. I love this guy already. He makes learning coding fun. 😊
@zaynbaig31574 жыл бұрын
Ayyyye our first coding challenge in a while! And a good one at that!
@dave6012 Жыл бұрын
The fact that the first million digitals is 1mb and the first billion is 1gb gives me great satisfaction.
@KellyMurphy4 жыл бұрын
BCD encoding the file would be 500Meg for a 1 billion digits file, not sure how much you'd get from gz or zip since pi is a high entropy number.
@LandonHughes24 жыл бұрын
Ah!!! You are so close to 1 million subs!! Congrats Dan! You’ll always be the guy that made programming click for me :)
@thomasdevelops30874 жыл бұрын
Congrats on 1 millions subs! Love these challenges! I wish you a lot of luck in the future of your channel
@jAMES-xy6wh4 жыл бұрын
You are the best. Your energy is incredible, the world needs more like you. My wife asks what is that song you are singing? lol a man in his 50s singing coding train. THANKS!!!
@metedmtss4 жыл бұрын
Why You Dont try make a random face ganerator in processing(or you cant do that?)
@CEBRAHULKANTWA4 жыл бұрын
KMP is best algorithm for me.
@vishalmishra19374 жыл бұрын
this man can visualize anything
@jasonspence4 жыл бұрын
It would be really neat to have the node server lazily evaluate pi as you search, until it finds the string of digits, no matter how long it takes.
@Budzique4 жыл бұрын
I have plenty enough file storage on my local server for 1 trillion digits (43.7GB), I may be able to set it up as a coding challenge by dumping the variables as I run out of ram and searching chunks of the file, but it would be quite a slow process.
@Xnoob5454 жыл бұрын
But shouldnt it be 1TB thats insane compression
@andrewnunes91484 жыл бұрын
Try to use KMP algorithm and look for matchs while you read the stream
@adamwest83324 жыл бұрын
This requires at last 1gb or RAM! Yiou should search directly from the stream, searching in chunk by chunk
@TheCodingTrain4 жыл бұрын
Good point!!!
@lucaseaston Жыл бұрын
If you substituted music notes for numbers, what would Pi sounds like? You could also see if you could find certain melodies within Pi. Edit: I commented this before watching till the end of the video haha.
@joostvanrens4 жыл бұрын
Peek in pi => pecan pie, just so it's easier to remember
@debumukhopadhay5414 жыл бұрын
0:00 Why, happy Pi day to you too!
@GrayBlood13314 жыл бұрын
That buzz sound effect kept jump scaring me!
@assenv4 жыл бұрын
jup the buzzer is just wrong. short conductor whistle or passing train will be much more fitting ;)
@charliedinerman79414 жыл бұрын
You should calculate pi in the code so you can just set a number for the number of digits you want
@NStripleseven4 жыл бұрын
Can we get some more coding challenges? Maybe 3D tic-tac-toe or adding physics to your fractal trees from ages ago?
@el_magoxd4 жыл бұрын
I promise you that I was waiting this video from 1 year ago
@Jack-cu5il4 жыл бұрын
Nice! I saw this suggestion on the github and was hoping you'd do it.
@prabhatkumar8173 Жыл бұрын
Hi can make programe which can read the chart provided by a website on the screen and create signals on activity detected !?
@moussaibrahem94 жыл бұрын
the video title should be *Writing Built in Javascript Function* 😂😂 Thanks for this great video
@axelmoriceau84354 жыл бұрын
You know things get handy when it comes to a 1GB file of plain text
@silentgrove76704 жыл бұрын
Is there a pi inside pi find 3 then 31 then 314 then 3141 I wonder what that sequence would look like ?
@thenormalguy85742 жыл бұрын
hey dan! i am trying to implement this to my express server which holds projects, but it seems like the app.use overrides the front page (which is "/"). can anyone help me?
@xot98974 жыл бұрын
Great video, youre a very engaging teacher, would you consider doing some videos on functional programming, preferably Haskell, I have trouble understanding it and there hardly any good tutorials on KZbin
@Julian-xe5is4 жыл бұрын
wasn't pi supposed to be a non-repeating and non-terminating decimal number? there are repeating numbers in this video though (such as ....99999....)?
@avi124 жыл бұрын
10:04 If the condition ends up being true, you can just return -1 instead of keeping track of a variable "found"
@Justinba10104 жыл бұрын
You can't do so, you need to exhaustively search the entire string. Say you're looking for 1419, U would go 1 4 1, then 5, but you cannot exit there.
@ryan-heath4 жыл бұрын
You could speed it up by a factor of 4 by instead of search for chars, search for longs (that is 4 chars at once). Caveat is that your search string should be at least 4 chars ... Even faster would be keeping track of where all digits are, that would speed it up by factor of ten, but you would use 10 times more memory. Performance tuning is always a trade-off for something else 😬
@TheCodingTrain4 жыл бұрын
Thanks for these suggestions!
@agcummings114 жыл бұрын
The computer would still have to compare the sane number of bits, so it isn’t really a 4x speed up
@ryan-heath4 жыл бұрын
See it like this: compare 12 bytes or compare 3 longs. The amount of bits is the same but the CPU can do it in less instructions, thus faster.
@techsupport32274 жыл бұрын
Do you know any other code languages other than java script? I learned the bare minimum of java script and now I’m learning html to create a website for my friend
@mitchellpincham5954 жыл бұрын
What about actually calculating the first thousand or million or so digits of pi?
@davidcullingford57084 жыл бұрын
double value=sqrt(2.0); println(value); // prints many decimal places. text(value, 100,100); gets an error.
@InXLsisDeo Жыл бұрын
No need for a bigger file. The natural challenge here is to compute the digits themselves. But I guess it requires a bit of mathematics.
@haris6214 жыл бұрын
After 1 billion you would need to use algorithms similar to sorting algorithms.
@farhannr284 жыл бұрын
Damm i even still haven't moved on since the last pi day special
@giveaway40024 жыл бұрын
waiting for this on pi day!!!!!
@delta6194 жыл бұрын
what if i +j will exceed the length of the text file , when the value of i is at last , or somewhere in the last
@luisgeniole3694 жыл бұрын
27:56 We can use the tail command in bash to cat the last ten digits like so: tail -c 10 pi-billion.txt
@delta6194 жыл бұрын
Brent Trenholme i thought it may give an exception something like out of bounds.
@delta6194 жыл бұрын
Brent Trenholme yeah 😄, thnx
@TheCodingTrain4 жыл бұрын
indeed, i should have accounted for this!
@delta6194 жыл бұрын
The Coding Train i need coding train sticker for my laptop if i may ask. 🥺 Fan from India
@DannySullivanMusic4 жыл бұрын
This certainly has been an interesting year so far...
@angshu75894 жыл бұрын
All your videos are so great and so entertaining. Oh and: function askQuestion(question, sender) { if ( typeof question !== "string" && typeof sender !== "string" ) { return "The question and sender is not a proper one"; } if (question == "Any ideas for another video?" && sender == "David Shiffman") { return { getTheIdea: function() { console.log("Put the code to run this console.log as a reply"); } dumpIdea: function() { try { this.getTheIdea = null; } catch (e) { console.error("getTheIdea Cannot be deleted"); } } } } return "Sorry, No answer here..."; }
@airxperimentboom3 жыл бұрын
Love it!
@qwertygmr45214 жыл бұрын
Well, here In Spain we write the date in different order, so it is 14/3/20. Which is pretty sad 😞😞
@leo8484 жыл бұрын
Qwerty GMR Same in Europe
@cosminturtureanu6924 жыл бұрын
@@leo848 Spain is in Europe
@cosminturtureanu6924 жыл бұрын
@@HiHi-ur3on oh yeah.. i forgot it just moved
@cosminturtureanu6924 жыл бұрын
@@HiHi-ur3on yeah.. after all, you should eat your cereal
@leo8484 жыл бұрын
Cosmin Cosmin I meant holy Europe
@necaton4 жыл бұрын
Happy Pi day!
@Xiaolong-sh5tl4 жыл бұрын
I came here for Pie... but all he was talking about was PI.
@flamexode4 жыл бұрын
How about searching for the digit of a certain digit in pi? Could be an interesting recursive function
@zulnabilfaizmoh.alhadad87294 жыл бұрын
Sir, I like how you deliver content about machine learning. I really want good people like you to contribute in the fight against corona virus. I have an idea, what if you create content about the neural network chatbot. I think this is useful for socialization about corona virus to the public. Some doctors say, prevention is the best medicine for all diseases. The socialization of preventing corona virus at this time is the most needed thing to suppress the virus spread. Thanks, i hope you at least read this.
@purifierphoenixthemecca4 жыл бұрын
Bailey-Borwein-Plouffe formula
@John-qx1xn4 жыл бұрын
Or, in two minutes but with no error checking but including time to download file: import sys target = sys.argv[1] data = open('onemeg.dat').read() pos = data.find(target) if pos < 0: print '{} not found'.format(target) else: print '{}: {} {}'.format(pos, target, data[pos+len(target):pos+41])
@Nola1222Piano4 жыл бұрын
I love this!
@SimonTiger4 жыл бұрын
Code simplification: let start = search.charAt(0); for (let i = 0; i < txt.length; i++) { if (txt.charAt(i) === start) { let found = true; for (let j = 1; j < search.length; j++) { if (txt.charAt(i + j)) !== search.charAt(j) { found = false; break; } } if (found) { return i; } } } return -1; is the same as for (let i = 0; i < txt.length; i++) { if (txt.charAt(i) === search.charAt(0)) { let found = true; for (let j = 1; j < search.length; j++) { if (txt.charAt(i + j)) !== search.charAt(j) { found = false; break; } } if (found) { return i; } } } return -1; is the same as for (let i = 0; i < txt.length; i++) { let found = true; for (let j = 0; j < search.length; j++) { if (txt.charAt(i + j)) !== search.charAt(j) { found = false; break; } } if (found) { return i; } } return -1;
@shurmurray4 жыл бұрын
But 1 million digits of Pi file should weight only about 2 megs - in 2020 it is nothing even for JS. It is very small amount of memory. And, well, 1 billion is about 2 gigs, depends on encoding.
@bencekovacs87264 жыл бұрын
You are supposed to use pattern matching for this problem, and not for loops..
@lucasg.55342 жыл бұрын
you are supposed to shut up
@RubyPiec4 жыл бұрын
Cool idea!
@dekanex4 жыл бұрын
Why number 3 is not in?
@sirynka4 жыл бұрын
Isn't it as easy as pressing ctrl+f inside a pi.txt file?
@basilbaby20694 жыл бұрын
Close to 1 million subscribers ♥️♥️
@XallbX4 жыл бұрын
Make a Picross solver.
@surendrasandun4 жыл бұрын
I love pi day challange😍
@adrianshawuk4 жыл бұрын
You must do Tau Day too
@hakankosebas20854 жыл бұрын
Make plastic deformation simulation
@olasoderlind56854 жыл бұрын
is there a Prossesing Server ?
@SquooshyShark10004 жыл бұрын
15:07 it's not binary, it's hexadecimal I know that because I do Unicode stuff every now and then
@Justinba10104 жыл бұрын
They're interchangeable in this context. It is just outputted as hexadecimal, it is technically a binary, usually buffers are binary data. What does unicode have to do with this anyway?
@ZK-im6er4 жыл бұрын
Is it maybe fun, to find self indexing numbers in the first billion numbers of Pi? So like 3.1415(edit) 1 would be index 1 and thus be its own index. Or maybe if 1 would index 0. I got the idea from this Numberphile video about looping numbers in Pi( starting with a given number, finding its index, than looking at that numbers it index and so on) Here is the video kzbin.info/www/bejne/jWOTkodnadlrhtk
@CyCloNeReactorCore4 жыл бұрын
What program is he using?
@milothegoat2804 жыл бұрын
9:40 is he writing on the wall with a sharpie??
@TheCodingTrain4 жыл бұрын
don't worry it's a dry erase whiteboard
@bensmart28294 жыл бұрын
He even included inside in the title
@sujatapanigrahy71723 жыл бұрын
Im gonna make this in python
@chadwickhjones4 жыл бұрын
Pi day should be 14% through the month of March, not the 14th day of March.
@pascha45274 жыл бұрын
10:00 txt.charAt(int) at line 17 could overflow.....
what the hell dude, why you gotta do me like that? At 0:59 your buzzer sounds exactly like my door bell and i went outside to check if anybody just rang... *EDIT:* and he keeps using that buzzing sound throughout the video....
@TheCodingTrain4 жыл бұрын
Ooops, sorry about that!
@iradnuriel90874 жыл бұрын
You could implement kmp algorithm, this algorithm is not so hard to implement...
@ebentee4 жыл бұрын
Whoever read this, you'll be successful one day. Let's do this for the future
@that_billu_guy4 жыл бұрын
Happy Gilfoyle
@nonono81084 жыл бұрын
Oh, do you have a new character?
@JambaYCS4 жыл бұрын
i was in chat during the stream :))
@mikewonghongkee44804 жыл бұрын
Happy 🥧 day🤓
@thomasdevelops30874 жыл бұрын
When is 1 trillion coming haha
@leo8484 жыл бұрын
I forgot it was pi day... SHAME ON ME
@levinsondsouza4 жыл бұрын
you are pi pi poo poo
@RubyPiec4 жыл бұрын
@@levinsondsouza pie pie?
@xxxxxijhin4 жыл бұрын
NINE NINE NINE NINE NINE NINE
@Xnoob5454 жыл бұрын
Do 1 trillion
@wt0304 жыл бұрын
Great video, but this annoing sound when you correct yourself...
@origedit4 жыл бұрын
Peeing inside Pik -_-
@manuelesparza53214 жыл бұрын
dude literally i had this idea like a week ago to publish it today (pieandme.com)
@zfoell4 жыл бұрын
Suggestion for the editor: have music playing in the background and increase the volume of the music when showing a fast forwarded lapse of Dan working through code, rather than having the music cut in and out
@grainfrizz4 жыл бұрын
This is O(N²)
@amey70644 жыл бұрын
It's actually pretty close to theta(n), since the length of the sequence to be searched is small relative to s billion digits
@ryan-heath4 жыл бұрын
I think the big o is still O(N) It would be O(N^2) when your search string would be always as big as the digits of PI