Anonymous user
De Bruijn sequences: Difference between revisions
m
→{{header|zkl}}: minor rewrite
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Fix off-by-one error. Thanks Purefox!) |
m (→{{header|zkl}}: minor rewrite) |
||
Line 434:
chk:=Dictionary();
foreach n in ([0..seqText.len()-1]){ chk[seqText[n,4]]=True }
(9999).pump(List,"%04d".fmt,'wrap(k){ if(chk.holds(k)) Void.Skip else k })
}
println("\nMissing 4 digit PINs in this sequence: ", chk(seqText).concat(" "));
print("Missing 4 digit PINs in the reversed sequence: ",chk(seqText.reverse()).concat(" "));▼
▲print("Missing 4 digit PINs in the reversed sequence:");
println("\n4444th character in the sequence: ", seqText[4444]);
dbSeq[4444]+=1;
println("Adding 1 to the 4444th character and reruning checks: ",chk(dbSeq.text).concat(" "));</lang>
{{out}}
<pre>
Line 459 ⟶ 452:
6898689969697769786979698769886989699769986999777787779778877897798779978787978887889789878997979887989799879998888988998989999000
Missing 4 digit PINs in this sequence:
Missing 4 digit PINs in the reversed sequence: ▼
▲Missing 4 digit PINs in the reversed sequence:
4444th character in the sequence: 5
Adding 1 to the 4444th character and reruning checks: 1459 4591 5914 8145
</pre>
|