login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A197124 Extract positive numbers from the infinite string of prime numbers 235711131719..., constructing the smallest numbers which have not appeared in an earlier extraction. 3

%I #24 Apr 01 2022 11:40:02

%S 2,3,5,7,1,11,31,71,9,23,29,313,74,14,34,75,35,96,16,77,17,37,98,38,

%T 99,710,110,310,7109,113,12,713,1137,13,91,4,915,115,716,316,717,317,

%U 918,119,1193,19,719,92,112,232,27,22,923,32,39,24,125,1257,26

%N Extract positive numbers from the infinite string of prime numbers 235711131719..., constructing the smallest numbers which have not appeared in an earlier extraction.

%C 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.

%H Paul Tek, <a href="/A197124/b197124.txt">Table of n, a(n) for n = 1..10000</a>

%e 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.

%t 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 *)

%o (Python)

%o from sympy import nextprime

%o from itertools import islice

%o def diggen():

%o p = 2

%o while True:

%o yield from list(map(int, str(p)))

%o p = nextprime(p)

%o def agen(): # generator of terms

%o g = diggen()

%o aset, nextd = set(), next(g)

%o while True:

%o an, nextd = nextd, next(g)

%o while an in aset or nextd == 0:

%o an, nextd = int(str(an) + str(nextd)), next(g)

%o yield an

%o aset.add(an)

%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, Mar 31 2022

%Y Cf. A032759, A228595.

%K nonn,base

%O 1,1

%A _Yves Debeuret_, Oct 10 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 04:14 EDT 2024. Contains 371918 sequences. (Running on oeis4.)