Talk:Möbius function: Difference between revisions

From Rosetta Code
Content added Content deleted
(added a talk topic.)
 
Line 7: Line 7:


Or, should solutions treat zero as a special case?     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:12, 25 January 2020 (UTC)
Or, should solutions treat zero as a special case?     -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 22:12, 25 January 2020 (UTC)

:Zero is not a positive integer. The Möbius function is undefined at zero. No need to special case it. I don't see any examples that show a Möbius number for zero. Which ones are showing a value at zero? The only example that shows ANYTHING for an input of zero is the REXX example, and while that's a little odd, I wouldn't count it as wrong, as it specifically states that "bullet (•) to signify that a "null" is being shown (for the 0th entry)" ¯\_(ツ)_/¯ If REXX can't easily skip over zero, I'm not going to hold that against it. --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 22:51, 25 January 2020 (UTC)

Revision as of 22:52, 25 January 2020

Möbius function for positive integers

This task says to write a function to     ... find the Möbius number for a positive integer   n.

But it is also apparently being used to find the Möbius number for zero, a non-positive number, as zero is apparently the 1st term as shown in the task's first written example's output.

Could/should it be stated:   ... find the Möbius number for a non-negative integer n     ?

Or, should solutions treat zero as a special case?     -- Gerard Schildberger (talk) 22:12, 25 January 2020 (UTC)

Zero is not a positive integer. The Möbius function is undefined at zero. No need to special case it. I don't see any examples that show a Möbius number for zero. Which ones are showing a value at zero? The only example that shows ANYTHING for an input of zero is the REXX example, and while that's a little odd, I wouldn't count it as wrong, as it specifically states that "bullet (•) to signify that a "null" is being shown (for the 0th entry)" ¯\_(ツ)_/¯ If REXX can't easily skip over zero, I'm not going to hold that against it. --Thundergnat (talk) 22:51, 25 January 2020 (UTC)