Skip to content

CoralSmith/1-MakingPalindromes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1 - Making Palindromes

Challenge #218 [Easy] from r/DailyProgrammer - Making numbers palindromic

To covert nearly any number into a palindromic number you operate by reversing the digits and adding and then repeating for N steps until you get a palindromic number. Note that, as an example, 196 never gets palindromic. Several numbers never appear to approach being palindromic - these are called Lychrel numbers.

Examples:

  • 24 gets palindromic after 1 step(s): 66 -> 24 + 42 = 66
  • 28 gets palindromic after 2 step(s): 121 -> 28 + 82 = 110, so 110 + 11 (110 reversed) = 121.

Tasks

  1. Given a number (one per line) describe how many steps it took to get it to be palindromic, and what the resulting palindrome is.
  2. Bonus 1: See which input numbers, through 1000, yield identical palindromes.
  3. Bonus 2: Find Lychrel numbers by seeing which numbers don't get palindromic in under 10000 steps.

About

Challenge #218 [Easy] from r/DailyProgrammer - Making numbers palindromic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages