%I #3 Dec 05 2013 19:55:20
%S 12,21,33,42,51,62,72,81,91,102,111,121,132,141,152,161,171,182,192,
%T 201,212,221,231,242,252,261,272,282,291,301,312,321,332,341,351,361,
%U 371,381,391,402,411,422,432,441,451,462,471,481,492,501,511,522,531
%N Smallest nontrivial composite number beginning with n.
%C Nontrivial means that simply appending a 0 to n is not allowed, nor is n itself.
%t a[n_] := (j = ToString[n]; l = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "01", "02", "03", "04", "05", "06", "07", "08", "09"}; k = 1; While[c = ToExpression[ StringJoin[j, ToString[ l[[k]] ]]]; k < 19 && PrimeQ[c], k++ ]; If[k < 19, Return[c]]; i = IntegerDigits[n]; k = 10; While[c = FromDigits[ Join[i, IntegerDigits[k]]]; PrimeQ[c], k++ ]; Return[c]); Table[ a[n], {n, 1, 55}]
%Y Cf. A071262.
%K nonn,base,easy
%O 1,1
%A _Amarnath Murthy_, May 30 2002
%E Edited by _Robert G. Wilson v_, Jun 14 2002
|