StealthyCoder

code

The next thing we can optimize is the fact that the result of the powers calculation does not change during the same length of the numbers. In order words, 3 ** 3 does not change for the numbers 123, 345, 543 and any other number containing a 3 in the range of 100 – 999.

Read more...

A small mini optimization is to move the call to len out as the length of the number does not change.

Read more...

The first improvement we will make is to move away from int to string to int conversion in the previous code and implement integer only operations. We can do this by using the modulo and floor integer division.

Read more...

This first part will deal with setting up the problem and the first initial code.

Problem

The problem to solve is to find the first x amount of Narcissistic Numbers . What they are is easy to explain. The process by which to identify if a number is narcissistic is by following these steps:

Read more...

So in the previous post I showed how to use the pattern of Suppliers and Consumers to structure any kind of input and output of data and structuring the processing. Well for bonus points we are going to make something fancy, a Chain. A Chain is nothing more than the series of steps that starts with one action and the result of that action will be the input for the next action and so on all the way till the end. Let us make one.

Read more...

This post will touch on two subjects that I already talked about, Amara's Law and creativity thrives in structure. I will reiterate Amara's Law here though:

We tend to overestimate the effect of a technology in the short run and underestimate the effect in the long run.

Read more...