Talk:Greatest prime dividing the n-th cubefree number: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎The logic of cubes_before(): analog to Totient function?)
Line 1: Line 1:
== The logic of cubes_before() ==
== The logic of cubes_before() ==
Fairly obviously there are 31 multiples of 8(2^3) less than 249, and 9 multiples of 27(3^3), however of course we have to account for 8*27 = 216 being in both. I'm pretty sure it's fairly standard fare, but the logic of accounting for >=3 such clashes is eluding me. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 02:07, 6 March 2024 (UTC)
Fairly obviously there are 31 multiples of 8(2^3) less than 249, and 9 multiples of 27(3^3), however of course we have to account for 8*27 = 216 being in both. I'm pretty sure it's fairly standard fare, but the logic of accounting for >=3 such clashes is eluding me. --[[User:Petelomax|Petelomax]] ([[User talk:Petelomax|talk]]) 02:07, 6 March 2024 (UTC)
:Would something like a modified "Totient function" something adequate.<br>'''counts the integers up to a given positive integer n that are relatively prime to n'''<br>[[Totient_function#C]]<br>Instead testing with primes than only with primes cubed.Needed to be tested. --[[User:Horst|Horst]] ([[User talk:Horst|talk]]) 19:20, 6 March 2024 (UTC)

Revision as of 19:20, 6 March 2024

The logic of cubes_before()

Fairly obviously there are 31 multiples of 8(2^3) less than 249, and 9 multiples of 27(3^3), however of course we have to account for 8*27 = 216 being in both. I'm pretty sure it's fairly standard fare, but the logic of accounting for >=3 such clashes is eluding me. --Petelomax (talk) 02:07, 6 March 2024 (UTC)

Would something like a modified "Totient function" something adequate.
counts the integers up to a given positive integer n that are relatively prime to n
Totient_function#C
Instead testing with primes than only with primes cubed.Needed to be tested. --Horst (talk) 19:20, 6 March 2024 (UTC)