DB<34> sub dig { my @res= reverse split //,$_[0]; return @res,(0) x 4} DB<35> sub repeat { my %h; @h{@_}=(); return 1 if @_ > keys %h } DB<36> $d=4; $c=0; for $i (2..4) { for $x (1..10**$d) { $p = $i*$x+$c ; @x = dig($x); @p = dig($p); next if repeat($i,@x[0..$d-1], @p[0..$d]); next if $p[4]; print "($i * $x) + $c = $p \t $i \t @x[3,2,1,0] \t@p[4,3,2,1,0]\n" }} (4 * 1738) + 0 = 6952 4 1 7 3 8 0 6 9 5 2 (4 * 1963) + 0 = 7852 4 1 9 6 3 0 7 8 5 2