OFFSET
1,1
COMMENTS
The infinite stream of prime digits is basically chopped into slices such that each of the digits is used exactly once and the outcoming stream does not contain duplicates.
LINKS
Paul Tek, Table of n, a(n) for n = 1..10000
EXAMPLE
The initial digits 2, 3, 5, 7 and 1 are all extracted in the order of occurrence. The next 1 is rejected because it appeared earlier, and united with the (overall) third 1 to extract 11. The next 3 (from 13) appeared already earlier and is combined with the following 1 (from the 17) to created 31.
MATHEMATICA
nn=100; digs = Flatten[Table[IntegerDigits[Prime[n]], {n, nn}]]; numList = {}; While[digs != {}, num = 0; While[num = num*10 + digs[[1]]; digs = Rest[digs]; newNum = ! MemberQ[numList, num]; (num == 0 || ! newNum) && digs != {}]; If[newNum, AppendTo[numList, num]]]; numList (* T. D. Noe, Oct 31 2011 *)
PROG
(Python)
from sympy import nextprime
from itertools import islice
def diggen():
p = 2
while True:
yield from list(map(int, str(p)))
p = nextprime(p)
def agen(): # generator of terms
g = diggen()
aset, nextd = set(), next(g)
while True:
an, nextd = nextd, next(g)
while an in aset or nextd == 0:
an, nextd = int(str(an) + str(nextd)), next(g)
yield an
aset.add(an)
print(list(islice(agen(), 80))) # Michael S. Branicky, Mar 31 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Yves Debeuret, Oct 10 2011
STATUS
approved