1 is the loneliest number...
The OEIS thinks the sequence starts at 1. Obviously the task as originally specified draws from a source that thinks you should skip the 1, perhaps by analogy with prime numbers, which might or might not be construed as a false analogy, since the sequence contains other non-primes like 25, and since this sieve is based on position, not on value, as primes are. I like it with the 1, and marked the Python entry as incorrect somewhat tongue-in-cheekly, but I think we can agree that we oughta agree on definition one way or the other before this becomes a real task. :-) --TimToady (talk) 21:41, 15 March 2014 (UTC)
- Thanks Tim, I was so focused on the sieve loop, I forgot the initial 1. --Paddy3118 (talk) 08:23, 16 March 2014 (UTC)
Needs proper description
The OEIS wiki page's description of Ludic sequence generation is very clear, while that of the task page here is very much not. By the wording here, step 1 gives 2, 3, 4, ..., and L = 2; step 2 wants to "remove every L'th indexed item from the array (including the first)", which means what, remove 2 (the first), 3 (first L-th), 5 (second L-th), and so on? So are we left with 4, 6, 8... now? And what's the difference between "every L'th indexed" and, say, just "every L-th"?
Also, I believe the "th" suffix is more commonly typeset as "L-th" or "Lth" (the italic "L" in the latter optional.) --Ledrug (talk) 08:40, 16 March 2014 (UTC)
Task description generator
Somewhere to stash it. <lang python>from nth import nth
def _parray(array, indexed=None, nmax=25):
lst = array[:nmax] return ('
' + ( ('')
%i' % lst) if indexed else ('%i ' % lst) ) + ' '.join( (('%i' % l) if not indexed or i % indexed else (" %i" % l)) for i, l in enumerate(lst[1:], 1) ) + ' ...
def ludicpr(nmax=100, prloops=4):
print('The first ludic number is 1.') #yield 1 print('
To generate succeeding ludic numbers create an array of ' 'increasing integers starting from 2') lst = list(range(2, nmax + 1)) print(':%s' % _parray(lst)) print('(Loop)') i = 0 while lst and i <prloops: i += 1 print('* Take the first member of the resultant array as the next Ludic number ' '%i.' % lst) #yield lst print("* Remove every %s indexed item from the array (including the first)." % nth(lst)) print('::%s' % _parray(lst, indexed=lst)) del lst[::lst] if i == 1: print('* (Unrolling a few loops...)') print("""\