Factoring

Kids today have it so easy.

Back in my day, when we wanted a computer to solve a problem, we had to write a piece of code to make it happen.

Now, there’s an app for everything, it seems!

I had a great deja vu moment the other day.  I found this resource.

Prime Factorization Calculator

It’s based upon a simple premise.  Ask the user to enter a number, any number, and it will return all of the factors of the number that are prime numbers.

So, 11 should return just 11 since 11 is a prime itself.

And, 12 should return 2, 2, and 3.

Simple enough, right?

How about a number that’s not quite that solved mentally, like say 777.  That’s when it gets interesting and beyond the problem solving ability of mere mortals.

Screenshot 2017-10-04 at 07.05.27

Of course, you (as I did) will do a little mental mathematics to check this.  Or, perhaps you took the easy way out to check it with a calculator.

What particularly intrigued me was that this was a problem that I did in high school and later reused it in my own computer science classes.  It’s not a trivial problem for solution but there’s huge satisfaction when you get it to work.  I do recall a modification making it less open by indicating that the number input has to be equal to or less than 1000.

It also opens one of those teachable moments since 1 is not included.  Hey, isn’t 1 a prime number?  Great discussion ensued.

I still think that it’s a wonderful problem for students to design an algorithm and generate a computer solution.

For those students and others, there are all kinds of functionality at this resource.

Like they say, today there’s an app for darn near everything.

Author: dougpete

The content of this blog is generated by whatever strikes my fancy at any given point. It might be computers, weather, political, or something else in nature. I experiment and comment a lot on things so don't take anything here too seriously; I might change my mind a day later but what you read is my thought and opinion at the time I wrote it! My personal website is at: http://www.dougpeterson.ca Follow me on Twitter: http://www.twitter.com/dougpete I'm bookmarking things at: http://www.diigo.com/user/dougpete