Creating a formula for a question?
Mostrar comentarios más antiguos
Hello Dear Matlab users
I need some HELP.
I saw 'a "one-a-day" journal contest' question about so called 'perfect numbers'. (I don't know exact translation of the term). The question was as following:
The Number 18432 is a number that has a feature of non-zero digit in itself,non-repeating digit, also has the ability to split into their numbers sum and products. Also it's more one digit, positive number (it has a lot). Other examples are 12,432,3168,13248 and they go until the number reaches total 21 piece. Well the question asks:
what is the smallest one, greater than 18432??
I thought that I could write a m.file to answer this question.
I've tried to initiate the m.file as following
if true
A=sym('A%d%d',[1,5],'integer&&positive');
sum(A)
assumptions(A);
end
I know it needs a lot of work, but a general idea might spark some thoughts to reconfigure the necessary function.
Thank you already for your consideration.
6 comentarios
John D'Errico
el 25 de Sept. de 2015
Huh?????>?
"has the ability to split into their numbers sum and products"
What does this mean? I'm sorry, but that statement carries no mathematical meaning. If you want an any help at all, you need to be FAR more specific. Explain the problem. I'm sorry if English is not your natural language, but if you want help, you need to try a bit harder.
As far as your code goes, I have no idea what you thought MATLAB would do with it.
In general on problems of this sort, you need to do some advance mathematical thinking, as otherwise your code will spend a LOT of time searching, and inefficient code will be useless.
That part was actually reasonably close to the definition of a perfect number, which is a number that is the sum of its divisors (other than itself).
For example, 6 is divisible by 1,2,3 (and 6) and 6 = 1+2+3
Of course, then the rest of the question doesn't make sense, because the original poster seems to suggest that 18432 is a perfect number which is not true.
John D'Errico
el 25 de Sept. de 2015
@WAT - Yes, I do know what a perfect number is. But nothing in the question has anything to do with perfect numbers.
kerozi
el 25 de Sept. de 2015
Pankaj Kumar Sinha
el 21 de Mayo de 2017
I also want to this solution
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Historical Contests en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!