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”

LychreL…?! ¡Cheryl! – #WQS11

El amor nos hace hacer cosas estúpidas, a algunos los incita a comprar más de un centenar de flores, a soportar el frío más intenso pero muy por encima de todos nosotros, Wade VanLandingham decidió nombrar así a un puñado de números de los cuales se tiene la sospecha que existen pero que hasta el momento su existencia no ha sido demostrada.

449px-California_196.svg

Ojalá hubiera una imagen mejor de un 196…

Un número de Lychrel va exactamente de lo siguiente:

Un número de Lychrel es un número natural que no puede formar un palíndromo a través del proceso iterativo repetitivo de invertir sus dígitos y sumar los números resultantes. Este proceso es a veces llamado algoritmo-196 (en inglés 196-algorithm), a raíz del número más famoso asociado con el proceso. En base decimal, no ha sido demostrado que los números de Lychrel existan, pero algunos, incluyendo el 196, son sospechosos por motivos estadísticos y de heurística. El nombre «Lychrel» fue acuñado por Wade VanLandingham como un anagrama aproximado de Cheryl, el nombre de su novia.

Con información de Wikipedia.

En mi opinión personal, creo que este es el código más difícil al que nuestro maestro nos ha sometido pues he tardado al menos 3 días enteros pensando en como resolverlo y al fin, este es mi código:

# Este programa te ayudará a encontrar los números Lychrel que probablemente existan en un rango determinado por tí.

def inverse(x):
x = str(x)
x = x[::-1]
x = int(x)
return x

numbers = []
lychrel = []
x = int(input("Ingresa el número del cual quieres comenzar a evaluar: "))
x1 = int(input("Ingresa el número hasta el cual quieres evaluar: "))
print("El rango de número que vamos a analizar es de %s a %s" % (x, x1))
for i in range(x1-x+1):
numbers.append(x)
x = (x 
Sin título
Continue reading "LychreL…?! ¡Cheryl! – #WQS11"