Yo soy 196. Palindromes and Lychrel numbers

ANITA LAVA LA TINA

RECONOCER

RACE CAR

Here you can take a look at My code on GitHub.

You should really check out Orlando´s Blog post.  You´ll learn how to do it perfectly.

 

First of all, I really have to thank Orlando Lara. Thank you for your time doing those amazing videos teaching us mortals about #WSQ11. Also many thanks to my teacher Ken Bauer, for his video explaining how to use BigInteger s on the program. You should really check out Ken´s video, cause it is kind of complex how to use and compile programs with this BigIntegers.

Basically those were all my sources to make this program. I once again thank Orlando, for teaching us how to use strings and bool functions. Before this program, I had never used them.

Following Orlando´s guide (sorry for saying it so much, but is the truth), I made my program to work with only two functions. One flips out each number of the sequence, using this:

BigInteger Num_reverse (BigInteger i){

string neto = bigIntegerToString(i);
neto = string(neto.rbegin(),neto.rend());
i = stringToBigInteger(neto);

return i;
}

It is a command to flip out the string, but what the function does first is convert once again the number from BigInteger to string (which we had already done the inverse process). Then it reverses the string and converts it back to a BigInteger using “stringToBigInteger()”. 

So this function is called inside the main, on a for loop that runs from the lower bound of the sequence provided by the user to the highest. SO IT FLIPS EACH AND EVERY NUMBER OF THE SEQUENCE. After this, with an if, it checks out if the flipped number is equal to the original number. If this  is true, the we just found

Continue reading “Yo soy 196. Palindromes and Lychrel numbers”