Day 9 of Flatiron School

Seth Alexander
2 min readMar 8, 2017

--

Today was a slow day. The kids didn’t cooperate this morning and I got zero coding done before all three children were awake. That’s fine though. I didn’t expect every day to go perfectly to plan. It was actually a nice refresher day not starting with coding but still getting the rest of my morning routine done.

I did get in my night time session (minus a few minutes for good night kisses). I had some more in depth labs today and learned a lot about primality algorithms when I had the challenge of coding a test to see if a number is prime without using the Math library.

My code works but definitely is not something that would ever get put into production. It is not efficient, at all.

My inefficient solution.

I could make it even more efficient by changing that n/2 to the square root of n but I couldn’t get that helper method working. In the end I would want to implement something like what I found online that states:

So a more efficient method is to test if n is divisible by 2 or 3, then to check through all the numbers of form (6k | plus - minus | 1 | less than or equal to | square root of n). This is 3 times as fast as testing all m.

m is what’s happening right now in my solution. I had to type of the form because my image representation isn’t working correctly here on Medium. I utilized pipes to show each element.

Luckily, I won’t ever have to do that because Math is a library that I’ll be using in real life. I kind of felt like I did in my college Finance class when the professor told us we had to memorize all the formulas even though she had zero memorized herself because her computer did everything for her at her day job.

Time spent today: 1:44
Time spent total: 38:28
Lessons completed today: 3
Lessons completed total: 209

Back to Day 8. Continue to Day 10.

If you know someone that is thinking about doing an online coding bootcamp, please share this article on Facebook and Twitter.

And please click the 💚 below so that other people will see this here on Medium. Thank you for reading.

This originally appeared on my blog here.

--

--

Seth Alexander

Husband & Daddy. Engineer @EvidenceCare. @FlatironSchool graduate.