This is a question about a Project Euler problem. This is where you can find the description of the problem: https://projecteuler.net/problem=29
OK, first of all, let me clarify that I have solved this problem, I am just looking for an alternative solution that is based more on maths.
Second, in order to not spoil the problem for anyone that has not solved, please if you have not solved it, don't continue. :)
So,...
User Profile
Collapse
-
Project Euler #29 alternative solution
-
Look for decimal to binary and hexadecimal conversion functions. If google it, you will find a bunch of info! -
Great! So good luck and if ypu need something, just contact me.Leave a comment:
-
Yes, of course anytime! You can send me inbox message or even post here, if the question is relevant.
I would advice you, as you said, to use this information to build your own solution.
By no means should you just copy the code and not try on your own. In general, you should not copy code that you don't understand and forums are not for this purspose. The goal is to understand the idea of something and then working on it....Leave a comment:
-
I suppose you mean calling a function to do what I did in main and storing somewhere the solutions you find instead of just printing them. First of all, it is wrong to do something like what you did here:
In C, you can't just directly return two values.Code:return x1, x2;
So, what are the possible solutions? Well, the most simple way I can think at this moment is to create an array in main(), pass it to a function and store the...Leave a comment:
-
OK, so I will try to give you a better solution, because it is more general, I hope I will not complicate things, but since you are a programmer, you will probably get asked a lot more times for this solution. Also, I used the formula you gave me and it did not work(Personally , I see this formula for the first time). I ran your program and it gave me answers -72 and 60 which are not correct. Anyway, let's get started, I hope this is more helpful....Leave a comment:
-
Ooo, I think I understand. So, a = 1 by default, and you just have to give b,c or otherwise, p,q ?Leave a comment:
-
Man, I am really glad I helped. However, to be honest, I cannot really understand your solution. :P
Of course, I don't say it is right or wrong because I can't understand. ;)
Your purpose is to solve an equation of this type? :
a * x^2 + b * x + c = 0
If yes, then you need three numbers to be input in the program and these are: a, b, c.
In your initial post you state that you have only two numbers as input and...Leave a comment:
-
Do you want to find real roots for this type of equation?
a * x^2 + b * x + c = 0.
If yes, I will try to give you an answer without revealing the solution.
OK, you first should find the discriminent, say D, and this is
D = b^2 - 4 * a * c.
Now, you want to test cases for D. If D > 0, then that means that there are
2 possible real roots. If D = 0, then there is only one real root.
If D <...Leave a comment:
-
A very simple way is to put a <span> where you have put a <td> and the videos will be output horizontally because <span> is not block-element. Then, you can apply any style you want to the <span>s.Leave a comment:
-
C is a language that currently is not widely used. C++ is a language that is used a lot and it has a lot more cababilities than C. However, it is a big language and it is considered more difficult than C.
There's no bad thing in going into C before C++. You will basically learn a lot(and I mean a lot) of useful things that not only apply in C++ but in other languages as well. However, it is not a language that can offer you many job...Leave a comment:
-
There is actually a loop statement that we have to write ; and this is the do-while loop that exists in a lot of languages and has this form:
Now, for loops like for, while, if they are empty, i.e. they have no statements in the body, they should be terminated with a ;.Code:do{ statements; }while( condition );Leave a comment:
-
Ok, I don't know if I fully understand your question but I think you just want to find the first digit of a number(from the left) and output it. For example, if you have 123, you want to output 1.
Ok, I will write this in Python because I have not used visual basic at all, so I hope it helps. You basically just repeatedly divide the number with 10 as long as the number is bigger than 10. When you get out of the loop what will have remained...Leave a comment:
No activity results to display
Show More
Leave a comment: