#!/usr/bin/perl
use 5.016;
use warnings;
my @memo;
@memo[6, 9, 20] = (1) x 3;
sub f {
$memo[$_[0]] //= (f($_[0] - 6) || f($_[0] - 9) || f($_[0] - 20));
}
foreach(1 .. 10000){
f($_) or say;
}
IyEvdXNyL2Jpbi9wZXJsCnVzZSA1LjAxNjsKdXNlIHdhcm5pbmdzOwoKbXkgQG1lbW87CkBtZW1vWzYsIDksIDIwXSA9ICgxKSB4IDM7CgpzdWIgZiB7CgkoJF9bMF0gPiAwKSBvciByZXR1cm4gMDsKCSRtZW1vWyRfWzBdXSAvLz0gKGYoJF9bMF0gLSA2KSB8fCBmKCRfWzBdIC0gOSkgfHwgZigkX1swXSAtIDIwKSk7Cn0KCmZvcmVhY2goMSAuLiAxMDAwMCl7CglmKCRfKSBvciBzYXk7Cn0K