WSQ11 – Yo Soy 196

Background

creative commons licensed (BY-NC-ND) flickr photo by K & P: http://flickr.com/photos/kenandpauline/5490820

creative commons licensed (BY-NC-ND) flickr photo by K & P: http://flickr.com/photos/kenandpauline/5490820

Lychrel numbers are natural numbers that do not form a palindrome after successive additions to their inverse. See details on Wikipedia: http://en.wikipedia.org/wiki/Lychrel_number

What to Do

Your jobs is to create a program that asks the user for two pieces of data:

  • The lower bound of the sequence
  • The upper bound of the sequence
Then you check the values from the lower bound (inclusive) to the upper bound (inclusive) and make a report of them. During the analysis of each number, if a Lychrel number is found it should be reported immediately with something like “Found a Lychrel number: 196”

Details

The report must show:
  • The range of numbers analysed (lower to upper bound)
  • The number of natural palindromes (no addition to inverse needed)
  • The number of non-Lycherels encountered (become palindromes)
  • The number of Lycherel number candidates (that did not converge to palindrome)

Since you will not be able to prove that a number is Lycherel (since you cannot computer forever to check), our definition for a Lycherel candidate will be if a number does not converge after 30 iterations of applying the addition to the inverse.

To get this working well, you will need support for Big Integers. You can base your solution off my codebase on GitHub. Unzip all of the files in a directory and use the command “make” to compile. Run the executable.

Another option for supporting large integers is the GNU MP Bignum Library.

Video Demo

What to Submit

As usual, create a blog post explaining what you did, where you found resources (books, videos, web pages, friends) to help you solve this. Remember to put the tag #WSQ11 on your post so our blog hub picks that up.

You should include your code as a link to GitHub. You really should start using your GitHub repository now. If you need help on that, just ask Ken or your classmates.

And of course, leave any questions here as well as asking those questions on Twitter with the hashtag #TC1017 so we all see your question posted there.

CC BY 4.0 WSQ11 – Yo Soy 196 by Ken Bauer is licensed under a Creative Commons Attribution 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.