--Originally published at RAMGGV
Este programa busca un lychrel number dentro de un rango dado
--Originally published at Hensel
En este programa se trata de encontrar los números que son considerados como Lychrel, los que no son Lychrel y los palindromos naturales de un rango de datos ingresados por el usuario. Pero, ¿Qué es un palindromo? Pues este es un número el cual se puede leer igual de izquierda a derecha o de derecha a izquierda, por ejemplo el número 11 es un palindromo, ya que si lo lees por derecha o por izquierda sigue siendo 11, otro ejemplo es el del número 545. Ahora ya sabemos que es un palindromo, la pregunta que nos inunda en este momento es la siguiente, ¿qué es un número de Lychrel? Este es un número, el cual no puede convertirse en un palindromo a través del proceso repetitivo de invertir sus dígitos y sumar los números resultantes. Por ejemplo, 124 su inverso es 421 y al sumarlos obtendríamos 545, el cual sí es un palindromo.
Para poder realizar este programa se requirió de la ayuda del profesor Ken, él nos proporciono un video tutorial en donde explica el funcionamiento del programa y como descargar una librería llamada Biginteger la cual es fundamental para poder realizar el código. Aquí les dejo los links https://www.youtube.com/watch?v=PHZYtOhFAZs y https://www.youtube.com/watch?v=KMDDoipS9H0.
--Originally published at Programming course
This was the hardest WSQ I made, so basically I asked the user for an upper and under bound and then analyze using Lychrel numbers
I used Ken’s video and this article
--Originally published at Solving problems with programming
In this homework what we need to count in a range of numbers how many palindromes are, how many numbers aplying a certain formula convert into palindromes, and how many numbers are lycheral numbers. A palindrome is a number that reading it from left to right and right to left is the same number. A palindrome a nonpalindrome can be converted into one with an easy formula, flip the order of the the values and add it to the orginal value, the result will do a palindrome. Example: 100 + flip(001) = 101. The result of the example is a palindrome so the formula works. There are numbers that even with the formula don’t become palindromes. Those are called lychrel numbers. To identify a lucheral number we apply the formula 30 times, if we already applied the formula 30 times and the number is not a palindrome it is because is a lychrel number.
In this code we use an especial library called BigInteger.hh that it is an aditional library besides the ones that are alredy insalled in our computer. To add it you have to put all the files from the library in the location of you cpp file and use the command make to compile it. Also the including the library you have to use (” “), instead of (<>), you will see it in the code example code.
In this homework we cover #Mastery19 with the use of strings. Strings are also variables and we include the library <string> to use the lenght() function that works to count the number of characters of a string. In this program we count the number of characters to be able to flip a number and apply the formula of palindromes.
Another #Mastery15 that we cover with nested loops. In
Continue reading "Yo soy 196" --Originally published at Adal´s Blog
--Originally published at Programming the city
Finally I could did the code “Yo soy 196” this has been the most difficult WSQ I have ever done. Thanks to my classmate and friend Fabrizzio who helped me with this.
I really liked this code because it had me thinking many hours and also because it was a big challenge to work with extra libraries and BigIntegers variables, and if you want an advice, just check what Fabrizzio posted on YouTube, it will help you a lot and make this code as your heart and brain tells you to do it..
Don’t forget to add the libraries!!!
And the result is…
--Originally published at Ken's Disciple 01
Use of comments, C++ good style coding, basic types, outputs, inputs, calling and creating functions, libraries, conditionals, nesting conditionals, loops, recursion, strings etc. Almost every mastery topics will be covered in WSQ08: yosoy196.
Now things got complicated, it’s time to demonstrate what you’ve learned and more. Ok guys I’ll try to explain everything but I recommend you to check Victoria’s post, she helped me and it’s thanks to her that I wads able to do this WSQ, her post is full of information, she made it in Spanish and her post is full of images that may help you to understand it better.
First of all you’ll have to download ken’s codebase so you may want to check the what do do task before, also pease check the videos in that page, they’ll help a lot.
*In this 2 functions we are working with strings, you may have noticed that there is a weird string thing in both functions, well that allows us to get the inverse of a number and since it’s a sting, we have to use the functions that are also included in the program, the ones that
Continue reading "Level up" --Originally published at Loading…
This one was very hard! Es por eso que este post lo haré en español, para poder explicar CADA UNO DE LOS PASOS de la manera más clara y sencilla, y así ustedes puedan entenderme y tal vez aclarar sus dudas.
Lo primero que hice, fue descargar la carpeta que Ken tiene en Github, la verdad es que de eso no les puedo decir mucho porque estaba completamente perdida y Ken fue quien instaló todo eso en mi computadora. Después de ver que el código base de YoSoy196 funcionaba, me puse a investigar sobre lo que se supone que debe de hacer este código, vi los videos de Ken y revise los blogs de cursos anteriores, hasta que que encontré el código de Antonio, la verdad me fue de demasiada ayuda, gracias a él comprendí lo que debía de hacer y dejé de estar taaaaan perdida.
So…. lo primero es establecer las bibliotecas que vamos a usar, para que el programa corra necesitamos las bibliotecas string, iostream y BigIntegerLibrary.hh, que está incluida en la carpeta yosoy196 (la que acabamos de descargar). Después debemos de definir las funciones que necesitamos, en este caso solo necesitamos dos. La primer función es el bool is_palindrome, el cual recibe un string para poder analizar los datos, y tiene un if con la condición que si el string i es leído de la misma manera comenzando en el inicio como en el final, regrese un valor verdadero, de no ser así, regrese falso. La segunda función que usé es BigInteger apply196, que también recibe un string y establece uno nuevo, el cual es el string i leído a la inversa, y por último use stringToBigInteger para que regrese los valores de string a un valor de BigInteger (que es lo que usamos para nuestra variable n), y
Continue reading "Ciento noventa y seis." --Originally published at Solving Problems with Programming
PICTURE OF ACTOR
So in this nine week class I started with doing this WSQ09. I started reviewing in creating and calling functions in C++.#Mastery06, #Mastery07, #Mastery16 Use of recursion for repetitive algorithms, #Mastery17 When to use what type of repetition in a program, #Mastery18 Creation and use of Arrays/ Vectors in C++. Futhermore, in this WSQ assignment we have mostly all the topics of the course from 1 to 20.
What I did for this numeric program is solving the problem to the user by creating a program that asks the user for two pieces of data:
Since you will not be able to prove that a number is Lycherel (since you cannot computer forever to check), our definition for a Lycherel candidate will be if a number does not converge after 30 iterations of applying the addition to the inverse.
To get this working well, you will need support for Big Integers. So I need to use that library that my teacher ken bauer has given to me, here you go:
This link is for Library of Big Integer provided by ken bauer
Hence, the resources I need it to solve this program are here:
ken bauer
Similar code provided for Continue reading "#WSQ08 Yo soy 196 11/03/17 and WSQ08.cpp"
--Originally published at The Talking Chalk
Things have turned weird with this one… I tried to use vectors but it did not work, finding a method to get palidromic numbers I thought the code would work; however it does not print anything, neither returns nor terminates. I will continue fixing this code, but I would like to see if you see any problem with it. I used long as the Big Integer Library did not worked.
A huge thank you to Dario Mangel, whose video helped me quite a lot to understand the procedures of the code; were not for him, I would have done several functions that may not be necessary,
#include<iostream>
#include<vector>
//#include “BigIntegerLibrary.hh”
#include <math.h>
using namespace std;
long tester(long number)
{
long x;
while(number>0)
{
x=(x*10)+(number%10);
number=number/10;
}
return x;
}
int testerLych (long number)
{
long x;
int counter, y;
if(number==tester(number))
{
y=number+tester(number);
while (counter!=30 and x!=tester(x))
{
x=x+tester(x);
counter=counter+1;
if(counter!=30)
{
y=2;
cout<<number;
}
else
{
y=3;
}
}
}
return y;
}
int main()
{
int first, second, counter, prime, tested, tried;
long number;
cout<<“Lend a number…”<<endl;
cin>>first;
cout<<“Lend a bigger number…”<<endl;
cin>>second;
for(counter; second!=number; counter++)
{
number=first+1;
if(testerLych(number)==1)
{
prime=prime+1;
}
else if(testerLych(number)==2)
{
tested=tested+1;
}
else
{
tried=tried+1;
}
}
cout<<“Lychrel is “<<tested<<endl;
cout<<“Natural palindromes “<<prime<<endl;
cout<<“Tried palindromes “<<tried<<endl;
return 0;
}