OFFSET
1,2
COMMENTS
This is a base-10 string version of the EKG sequence A064413. Any number that contains only nonprime digits, does not contain any substring that is prime, and is not itself a prime can never appear, e.g., 4, 6, 8, 9, 10, 14. The first number to contain only digits 4, 6, 8 or 9 that does appear is a(524) = 489, as it contains the substring 89 which is prime and is a factor of a(523) = 534.
The fixed points begin 15, 72, 248, 249, 670, 1055, 1056, 1377, although it is likely their total number is unbounded.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000.
EXAMPLE
a(3) = 12 as a(2) = 2 and "12" is the smallest unused number to contain "2".
a(4) = 3 as a(3) = 12 = 2*3, and "3" is the smallest unused number to contain "3".
a(5) = 13 as a(4) = 3 and "13" is the smallest unused number to contain "3".
a(6) = 113 as a(5) = 13 and "113" is the smallest unused number to contain "13".
MATHEMATICA
nn = 120; c[_] := False; f[x_] := FactorInteger[x][[All, 1]];
g[x_] := g[x] = Select[FromDigits /@ Union@ Rest@ Subsequences@ IntegerDigits[x], PrimeQ];
Array[Set[{a[#], c[#]}, {#, True}] &, 2]; j = 2; u = 3;
Do[Set[{j, k}, {f[j], u}];
While[Or[c[k], # == {}, ! IntersectingQ[j, #]] &[g[k]], k++];
Set[{a[n], c[k], j}, {k, True, k}];
If[k == u, While[Or[c[u], g[u] == {}], u++]], {n, 3, nn}];
Array[a, nn] (* Michael De Vlieger, Sep 16 2023 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Sep 16 2023
STATUS
approved