Ludic numbers: Difference between revisions

m (used a consistent color for a highlighted numeral, used a more visible ellipse.)
Line 2,726:
 
=={{header|zkl}}==
This solution builds aan stackiterator ofwith iteratorsfilters, one for each Ludic number, each extending the previous iteratorfilter. A "master" iterator sits atopat the stacktop and provides the interface to the stack. When the next Ludic number is requested, athe "pulsenext train"odd ripplesnumber sent down andthe uplist of filters and downif ...it makes to the stackend, asit numbersis arethe crossednext offLudic number. A new filter is then attached [to the list(s)iterator] (figurewith a starting index of speech,1 noand numberswhich areindexes to cached)strike.
<lang zkl>fcn dropNth(n,seq){
if(n==2) return(seq.tweak(fcn(n,skipper,idx){ if(n0==idx.isEveninc()%skipper) Void.Skip else n })); // uggg, special case
.fp1(n,Ref(1))) // skip every nth number of previous sequence
seq.tweak(fcn(n,skipper,w){ if(0==(w.idx+1)%skipper) Void.Skip else n }.fp1(n),
Void.Void,Void.Void,True);
}
fcn ludic{ //-->Walker
Walker(fcn(rw){ w:=rw.value; n:=w.next(); rw.set(dropNth(n,w)); n }.fp(Ref([2..]))).push(1);
.fp(Ref([3..*,2]))) // odd numbers starting at 3
.push(1,2); // first two Ludic numbers
}</lang>
<lang zkl>ludic().walk(25).toString(*).println();
Anonymous user