Where do I learn about algorithms for comparing the sum of a number’s digits? (ex. the sum of the first and last three digits of 431,620 are both 8) via /r/learnprogramming


Where do I learn about algorithms for comparing the sum of a number’s digits? (ex. the sum of the first and last three digits of 431,620 are both 8)

(Note: PLEASE do not post sample code! It is vital I write this on my own.)

I'm entering a competition in which I need to know algorithms. Really specific patterns for numbers…One of the exercises is one in which we have to write a piece of programming language code that takes an integer (from 100,000 to 999,998) and finds the next integer in which the first and last three digits' sum are equal.

I am vaguely familiar with similar concepts, such as perfect numbers and palindromes, but this is lost on me. I know the problem is not my programming knowledge; the way my head works I need to know the algorithm/equation for finding such numbers. That way I can merely transcribe it to code.

Where do I begin?

Submitted July 17, 2017 at 05:54AM by gnuforlyfe
via reddit http://ift.tt/2thVmFg

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s