Mathematics and P5

I am interested in exploring how p5 can be used in math courses k-12. I recently was in a HS math course discussing this problem:

Which natural number from 1…N has the most factors. We started by creating a simple n^2 approach to the solution and realized its limitations. The next day I showed them the n log n approach animated in the sketch below. They were excited. As N grows in size you need different approaches. One of the students is trying to code a greedy solution of prime factorizations. I think this could lead to finding solutions with N as high as n^100. I am posting this link to start a conversation about what people have found to work in using computing to engage mathematical thinking. Also I would love to collaborate with people who want to work on figuring out where p5 fits into mathematics education.


Greg Benedis-Grab


Seen that

1 Like

Sounds like a great lesson @gbenedisgrab! Count me in for figuring this out.

My high school math students transitioned to p5.js a few weeks ago after starting with Scratch and a subset of the Creative Computing Curriculum. My goals are to motivate the core curriculum, deepen their understanding, and develop a range of useful skills.

Over the last few weeks, my students have drawn constellations and simulated rainfall. We’ve reviewed coordinate systems, variables, functions, domain and range, and inequalities in the process. I plan to develop projects for key topics in Algebra II this summer. @ashneel.das and I will also seed Dynamic Learning with lessons as part of his GSoC project.

1 Like

Yes I am mentoring Oskar this summer. Thanks

1 Like

Thanks Nick. Let me know if I can be helpful. I am excited about how coding can help deepen mathematical thinking.


Happened to see this post about teaching geometry with JavaScript in my news feed this morning. That screenshot looks awfully familiar :wink:

I am starting to write the story of what I did with this lesson in a Google Collaboratory Page here It includes the above animation plus another p5 animation that I did with Glitch. Happy to talk more about these ideas with anyone interested.


Fantastic writeup – thank you so much for sharing it.

I wasn’t familiar with – still trying to understand what it is, but it looks very interesting.

Thanks for the compliment @jeremydouglass Glitch is a great platform for p5. You can load it from a github repo in one click and you have access to console.