Talk:Lucky and even lucky numbers: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Wrong example of even luckies?: I think the descriptions can be improved)
m (→‎Wrong example of even luckies?: metathesized two words)
Line 16: Line 16:
''Lucky numbers'' are positive integers that are formed by:
''Lucky numbers'' are positive integers that are formed by:


:* take a list of all the odd positive integers
:* take a list of all the positive odd integers
:* take the 2<sup>nd</sup> number &nbsp; (which is &nbsp; ''' 3 ''')
:* take the 2<sup>nd</sup> number &nbsp; (which is &nbsp; ''' 3 ''')
:* remove every 3<sup>rd</sup> number
:* remove every 3<sup>rd</sup> number

Revision as of 01:59, 10 March 2014

Wrong example of even luckies?

take a list of all the positive even integers

2, 4, 6, 8, 10, ...

remove every 2nd number

2, 6, 10, ...

take the 2nd number (which is 4 )

Not 6?

(Also, why was this talk page deleted?) --Ledrug (talk) 09:09, 9 March 2014 (UTC)

I had a question that wasn't relevant once I understood the task more so deleted it almost immediately. --Paddy3118 (talk) 11:50, 9 March 2014 (UTC)
The sequence itself is correct, according OEIS, so the problem is in the description of the task. I believe the 2nd line in the second section is a copy/paste difficulty stemming from how the first sequence is defined. If instead of talking about deleting every other one, I suspect both sequences should be leave out the 2nd "skip every other one", and revise the first rule to be in terms of the odd numbers, the second sequence in terms of the even numbers. So we'd simply have:

Lucky numbers are positive integers that are formed by:

  • take a list of all the positive odd integers
  • take the 2nd number   (which is   3 )
  • remove every 3rd number
  • take the 3rd number   (which is   7 )
  • remove every 7th number
  • take the 4th number   (which is   9 )
  • remove every 9th number
  • take the 5th number   (which is   13 )
  • remove every 13th number
  • take the 6th number ···


definition of even lucky numbers

Even lucky numbers are positive even integers that are formed by:

  • take a list of all the positive even integers
  • take the 2nd number   (which is   4 )
  • remove every 4th number
  • take the 3rd number   (which is   6 )
  • remove every 6th number
  • take the 4th number   (which is   10 )
  • remove every 10th number
  • take the 5th number   (which is   12 )
  • remove every 12th number
  • take the 6th number ···
Parallelizing these descriptions shows how they are essentially the same algorithm (as shown by the parameterization of the algorithm in the Perl 6 solution). --TimToady (talk) 01:56, 10 March 2014 (UTC)

What does "Mixed case should be supported" mean?

This phrase can be read in diametrically opposite ways. I took it to mean that it doesn't matter what case you type the argument, which means the prior rule about spelling would only care if you had the wrong letters, not the wrong case. By this interpretation the Perl 6 entry is not incorrect in its argument handling, and the example is merely demonstrating case insensitivity. If this is not the intended meaning of "mixed case", it needs to be clarified in terms of case sensitivity vs insensitivity. Perhaps my intepretation is colored by my absolute loathing of "camel case" words, which I think have no place in a task such as this, if indeed they are being considered mandatory. It's quite challenging enough to meet the numeric challenges of this task without all the extra API folderol, in my estimation. --TimToady (talk) 01:09, 10 March 2014 (UTC)

(Also, if the quibble is that Perl 6 entry isn't following the first three rules, it is. It is, in fact, testing for those conditions with the signature matching. If the intent is to mandate some kind of particular error message in response to those errors, it should be made clearer just how anally the original implementation is to be copied.) --TimToady (talk) 01:24, 10 March 2014 (UTC)
(Or if the requirement is for a placeholder comma, it's certainly not necessary for the Perl 6 solution, though I could certainly make it throw one away easily enough. The point of Rosettacode is to show idiomatic usages, not force every language to show how it supports the limitations of other languages...) --TimToady (talk) 01:42, 10 March 2014 (UTC)