This one was really difficult so I start searching for help but I couldn’t find it. I decided to search the blogs of other people to see how they did it and I found one, in the post it said that we should watch ken’s video of bigintegers and I did. after that it was easier to do.<\/p>\n
#include <iostream>
\n#include “BigIntegerLibrary.hh”
\nusing namespace std;
\nint arr;
\nint ab;
\nint nat=0;
\nint non=0;
\nint ly=0;
\nBigInteger rev;
\nBigInteger num;<\/p>\n
BigInteger reverse(BigInteger valid){
\nBigInteger invalid= 0;
\nwhile (valid != 0){
\ninvalid= invalid*10 + valid % 10;
\nvalid= valid\/10;
\n}
\nreturn invalid;
\n}<\/p>\n
void palindrome(BigInteger n, BigInteger r){
\nif(n == r){
\nnat = nat+1;
\n}
\nelse {
\nint rep= 0;
\nBigInteger a= n;
\nwhile (a!=r && rep < 30){
\na=a+r;
\nr= reverse(a);
\nrep= rep+1;
\n}
\nif (rep == 30){
\ncout << “Este es un numero Lynchrel: ” << n << endl;
\nly= ly+1;
\n}
\nelse {
\nnon=non+1;
\n}
\n}
\n}<\/p>\n
int main (){ cout << “Los numeros estan entre: ” << ab << ” y ” << arr << endl; return 0;
\ncout << “Vamos a buscar cuantos numeros Lynchrel hay.” << endl;
\ncout <<” Introduzca el<\/span> l\u00edmite inferior<\/span><\/span>: “;
\ncin >> ab;
\ncout << “Introduzca el<\/span> l\u00edmite superior<\/span><\/span>: “;
\ncin >> arr;
\nnum = ab;
\nwhile(num <= arr){
\nrev= reverse(num);
\npalindrome(num, rev);
\nnum = num + 1;
\n}<\/p>\n
\ncout << ” Cantidad de palindromos naturales : ” << nat << endl;
\ncout << ” Cantidad de numeros no Lycherel: ” << non << endl;
\ncout << “Cantidad de numeros Lychrel: ” << ly << endl;<\/p>\n
\n}<\/p>\n