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!)
A152607 a(1) = 1; thereafter a(n) is always the smallest integer > a(n-1) not leading to a contradiction, such that the concatenation of any two consecutive digits in the sequence is a prime. 7
1, 3, 7, 9, 71, 73, 79, 711, 713, 717, 971, 973, 1111, 1113, 1117, 1119, 7111, 7113, 7117, 9711, 9713, 11111, 11113, 11117, 11119, 71111, 71113, 71117, 97111, 97113, 111111, 111113, 111117, 111119, 711111, 711113, 711117, 971111 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Computed by Jean-Marc Falcoz.
Comment from Jean-Marc Falcoz: (Start)
The sequence is infinite since it has the following structure:
9713, 11111, 11113, 11117, 11119, 71111, 71113, 71117, 97111,
97113, 111111, 111113, 111117, 111119, 711111, 711113, 711117, 971111,
971113, 1111111, 1111113, 1111117, 1111119, 7111111, 7111113, 7111117, 9711111,
9711113, 11111111, 11111113, 11111117, 11111119, 71111111, 71111113, 71111117, 97111111,
97111113, 111111111, 111111113, 111111117, 111111119, 711111111, 711111113, 711111117, 971111111,
971111113, 1111111111, 1111111113, 1111111117, 1111111119, 7111111111, 7111111113, 7111111117, 9711111111,
9711111113, ... (End)
LINKS
Eric Angelini, Chiffres consecutifs dans quelques suites [Cached copy, with permission]
PROG
(Python)
from itertools import count, islice
def cgen(seed, digits, geq="0"): # numbers satisfying the condition
allowed = {"1": "1379", "3": "17", "7": "139", "9": "7"}
if digits == 1:
yield from (c for c in allowed[seed] if c >= geq); return
for f in (c for c in allowed[seed] if c >= geq):
yield from (f + r for r in cgen(f, digits-1))
def nextc(k): # next element of cgen greater than k
s = str(k)
for d in count(len(s)):
geq = s[0] if d == len(s) else "0"
for c in map(int, cgen(s[-1], d, geq=geq)):
if c > k: return c
def agen():
an = 1
for n in count(1): yield an; an = nextc(an)
print(list(islice(agen(), 40))) # Michael S. Branicky, Jul 12 2022
(Python) # alternate using pattern from comments
from itertools import count, islice
def agen():
yield from [1, 3, 7, 9, 71, 73, 79, 711, 713, 717, 971]
for i in count(0):
i1 = "1"*i
yield from map(int, ("97"+i1+"3", i1+"1111", i1+"1113", i1+"1117", i1+"1119", "7111"+i1, "711"+i1+"3", "711"+i1+"7", "9711"+i1))
print(list(islice(agen(), 40))) # Michael S. Branicky, Jul 12 2022
CROSSREFS
Cf. A158652, A152604-A152609. See A152136 for another version.
Sequence in context: A087147 A363572 A337613 * A118559 A189244 A127789
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Sep 23 2009
STATUS
approved

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 May 8 13:24 EDT 2024. Contains 372333 sequences. (Running on oeis4.)