Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

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

Execution

git clone https://github.com/NumericalMax/196-algorithm.gitcd 196-algorithmg++ main.cpp -o main./main

Approach

Given 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 = 2

Note, 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.

Outcome

NumberIterationsFinal palindrome
101
202
303
404
505
606
707
808
909
10111
11011
12133
13144
14155
15166
16177
17188
18199
192121
20122

About

Implementation of the 196-algorithm to find palindromes in a predetermined sequence of instructions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp