1
perl -M'List::Util qw/reduce first/' -le 'print first{!((reduce{13*$a+$b}split//)%$_)}10..10000'