document.write( "Question 1105054: How many different 5-digit PINs contain the sequence 12 (order matters)\r
\n" ); document.write( "\n" ); document.write( "12000 counts
\n" ); document.write( "12121 counts
\n" ); document.write( "13332 doesn't count
\n" ); document.write( "

Algebra.Com's Answer #719898 by math_helper(2461)\"\" \"About 
You can put this solution on YOUR website!
There are 4 patterns to worry about:\r
\n" ); document.write( "\n" ); document.write( "12xxx —> \"+10%5E3+\"
\n" ); document.write( "x12xx —> \"+10%5E3+\"
\n" ); document.write( "xx12x —> \"+10%5E3+-+10+\" <<< minus 10 for the 1212x pattern already counted
\n" ); document.write( "xxx12 —> \"+10%5E3+-+10+-+10+\" <<< minus 20 for 12x12, x1212, both already counted
\n" ); document.write( " ——
\n" ); document.write( "That's \"+4x10%5E3+-+30+\" = 3970 \r
\n" ); document.write( "\n" ); document.write( "——
\n" ); document.write( "Check using a Perl one-liner:
\n" ); document.write( " perl -e 'for ($i=0, $s=0; $i<100000; $i++) { if ($i =~ /12/) { $s++; } }; print \"$s\n\";'
\n" ); document.write( "3970
\n" ); document.write( "
\n" ); document.write( "
\n" );