
EXAMPLE

a(2) = 3*7 = 21: divisors of 21 are 1, 3, 7, 21, all of which are lucky numbers.


MATHEMATICA

lst = Range[1, 2*10^7, 2]; i = 2; While[ i <= (len = Length@lst) && (k = lst[[i]]) <= len, lst = Drop[lst, {k, len, k}]; i++ ]; fQ[n_] := Block[{d = Rest@Divisors@n, k = 1, lmt = DivisorSigma[0, n]}, While[k < lmt && MemberQ[lst, d[[k]]], k++ ]; k == lmt]; t = Table[0, {10}]; Do[ If[ fQ@lst[[n]], a = Length@ FactorInteger@lst[[n]]; If[ t[[a]] == 0, t[[a]] = lst[[n]]; Print[ lst[[n]] ]]], {n, 2, Length@lst}] (* Robert G. Wilson v, May 12 2006 *)
