login

Revision History for A152607

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
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.
(history; published version)
#12 by Peter Luschny at Wed Jul 13 03:41:00 EDT 2022
STATUS

reviewed

approved

#11 by Joerg Arndt at Wed Jul 13 02:08:22 EDT 2022
STATUS

proposed

reviewed

#10 by Michel Marcus at Wed Jul 13 00:44:36 EDT 2022
STATUS

editing

proposed

#9 by Michel Marcus at Wed Jul 13 00:44:31 EDT 2022
COMMENTS

Comment from Jean-Marc Falcoz: (Start) The sequence is infinite since it has the following structure:

The sequence is infinite since it has the following structure:

9711111113, ... (End)

LINKS

E. Eric Angelini, <a href="/A152136/a152136.pdf">Chiffres consecutifs dans quelques suites</a> [Cached copy, with permission]

PROG

print(list(islice(agen(), 440))) # Michael S. Branicky, Jul 12 2022

STATUS

proposed

editing

#8 by Michael S. Branicky at Tue Jul 12 21:58:31 EDT 2022
STATUS

editing

proposed

#7 by Michael S. Branicky at Tue Jul 12 21:57:58 EDT 2022
PROG

def cgen(seed, digits, geq="0"): # generator of numbers satisfying the condition

if digits == 1: yield from allowed[seed]; return

yield from (c for c in allowed[seed] if c >= geq); return

for f in (c for c in allowed[seed]: yield from (f + r for r in cgen(f, digits-1) if c >= geq):

yield from (f + r for r in cgen(f, digits-1))

def nextc(k): # next element of cgen greater than k

geq = s[0] if d == len(s) else "0"

for c in map(int, cgen(s[-1], d, geq=geq)):

print(list(islice(agen(), 404))) # Michael S. Branicky, Jul 12 2022

#6 by Michael S. Branicky at Tue Jul 12 21:23:45 EDT 2022
PROG

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))

#5 by Michael S. Branicky at Tue Jul 12 21:03:21 EDT 2022
PROG

(Python)

from itertools import count, islice

def cgen(seed, digits): # generator of numbers satisfying the condition

allowed = {"1": "1379", "3": "17", "7": "139", "9": "7"}

if digits == 1: yield from allowed[seed]; return

for f in allowed[seed]: yield from (f + r for r in cgen(f, digits-1))

def nextc(k): # next element of greater than k

s = str(k)

for d in count(len(s)):

for c in map(int, cgen(s[-1], d)):

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

STATUS

approved

editing

#4 by N. J. A. Sloane at Thu Jun 09 21:27:54 EDT 2016
STATUS

editing

approved

#3 by N. J. A. Sloane at Thu Jun 09 21:27:52 EDT 2016
LINKS

E. Angelini, <a href="/A152136/a152136.pdf">Chiffres consecutifs dans quelques suites</a> [Cached copy, with permission]

STATUS

approved

editing