RosettaCodeData/Task/Gapful-numbers/Mathematica/gapful-numbers.math
2023-07-01 13:44:08 -04:00

23 lines
366 B
Text

ClearAll[GapFulQ]
GapFulQ[n_Integer] := Divisible[n, FromDigits[IntegerDigits[n][[{1, -1}]]]]
i = 100;
res = {};
While[Length[res] < 30,
If[GapFulQ[i], AppendTo[res, i]];
i++
]
res
i = 10^6;
res = {};
While[Length[res] < 15,
If[GapFulQ[i], AppendTo[res, i]];
i++
]
res
i = 10^9;
res = {};
While[Length[res] < 10,
If[GapFulQ[i], AppendTo[res, i]];
i++
]
res