Talk:Primes - allocate descendants to their ancestors: Difference between revisions

Content added Content deleted
(→‎Task is ambiguous: new section)
Line 40: Line 40:


So... would it be possible to rephrase the task to address these issues? --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 02:53, 26 February 2015 (UTC)
So... would it be possible to rephrase the task to address these issues? --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 02:53, 26 February 2015 (UTC)


:Hi, too.
(1) Timing. I already addressed this question, yesterday. See my answer to Paddy3118, point 3, above.

(2) I posted "... is to add the decomposition into prime factors of a number to get its 'ancestors'".

What difference does it make if there are more than 2 prime factors ?

I also gave the example of 3^33 = 5.559.060.566.555.523 (parent 99).

That is, 3^33 --> 3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3 = 99


The ancestor lists has to be provided for a delimited set of ancestors (from 5 to 99), see the task description.

And, yes, some ancestors may have common ancestors.


(3) If 25 is the Parent of 46, you can deduct that 46 is a descendant (child) of 25.

And I posted : "... use the decomposition into primes for all the numbers between 5 and 3^33".


The 557 descendants of the ancestor 46 are posted, since yesterday, see my answer to Paddy3118, point 1, above.


MAXPARENT is clearly stated in the task description (ancestors from 5 to 99).

MAXPRIME is also clearly stated in the task description "You only have to consider the prime factors < 100".

This information could also have been deducted from MAXPARENT.

And, yes, 99 is not a prime factor. MAXPRIME is given as an upper bound.

MAXPRIME is used to get a list of all the prime factors which are lower than (or equal to) MAXPRIME.


NBRPRIMES and NBRANCESTORS are only used to delimit the size of 2 tables. They are not relevant to solve the problem.


malloc(sizeof(Children))

Thanks, for this information, it's a typo, my compiler didn't even warn me on that. I changed the C code.

malloc(sizeof(struct Children))


I posted one solution, there are maybe hundreds.

Hope it helps!

--[[User:Old man|Old man]] ([[User talk:Old man|talk]]) 10:39, 26 February 2015 (UTC)