- Notifications
You must be signed in to change notification settings - Fork0
Implementation of the 196-algorithm to find palindromes in a predetermined sequence of instructions.
License
NotificationsYou must be signed in to change notification settings
NumericalMax/196-algorithm
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Implementation of the 196-algorithm to find palindromes in an iteratively computed number sequence.
Inspired byhttps://www.youtube.com/watch?v=bN8PE3eljdA&t=374s
git clone https://github.com/NumericalMax/196-algorithm.gitcd 196-algorithmg++ main.cpp -o main./mainGiven a number n we iteratively reassign to n the sum of n and the reverse of n until n is a palindrome.
Example Given:
n = 19 // no palindrome, iteration = 0n = 19 + 91 = 110 // no palindrome, iteration = 1n = 110 + 11 = 121 // palindrome, iteration = 2Note, that n is of type int. This can result in exceeding the allocated storage size for larger n or higher iterations. To prevent, you can set the datatype to long or a much larger datatype.
| Number | Iterations | Final palindrome |
|---|---|---|
| 1 | 0 | 1 |
| 2 | 0 | 2 |
| 3 | 0 | 3 |
| 4 | 0 | 4 |
| 5 | 0 | 5 |
| 6 | 0 | 6 |
| 7 | 0 | 7 |
| 8 | 0 | 8 |
| 9 | 0 | 9 |
| 10 | 1 | 11 |
| 11 | 0 | 11 |
| 12 | 1 | 33 |
| 13 | 1 | 44 |
| 14 | 1 | 55 |
| 15 | 1 | 66 |
| 16 | 1 | 77 |
| 17 | 1 | 88 |
| 18 | 1 | 99 |
| 19 | 2 | 121 |
| 20 | 1 | 22 |
About
Implementation of the 196-algorithm to find palindromes in a predetermined sequence of instructions.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published