OFFSET
1,1
COMMENTS
Pick any digit d of a(n): there are exactly d digits between d and the closest duplicate of d (either before or after) inside a(n).
There are infinitely many such terms.
From M. F. Hasler, Dec 19 2020: (Start)
If N is a term of the sequence, then:
(1) Any digit of N must be present at least twice in N (cf. A115853).
(2) N*10^k is also a term of the sequence, for all k >= 2.
(3) The reversal R(N) = A004086(N) is also a term (with leading zeros deleted). (End)
LINKS
David A. Corneth, Table of n, a(n) for n = 1..4080 (terms <= 10^12).
EXAMPLE
a(1) = 2002: in 2002 the closest duplicate of the first 2 is 2 positions away to the right, the closest duplicate of the first 0 is 0 position away to the right, the closest duplicate of the second 0 is 0 position away to the left, the closest duplicate of the second 2 is 2 positions away to the left;
a(2) = 30003: in 30003 the closest duplicate of the first 3 is 3 positions away to the right, the closest duplicate of the first 0 is 0 position away to the right, the closest duplicate of the second 0 is 0 position away (either to the left or to the right), the closest duplicate of the third 0 is 0 position away to the left, the closest duplicate of the second 3 is 3 positions away to the left;
a(13) = 2312131: if you pick any digit 1, the closest duplicate of this 1 is 1 position away (either to the left or to the right), if you pick any 2, the closest duplicate of this 2 is 2 positions away, if you pick any 3, the closest duplicate of this 3 is 3 positions away, etc.
PROG
(Python)
def nn(ti, t, s):
li = s.rfind(t, 0, max(ti, 0))
ri = s.find(t, min(ti+1, len(s)), len(s))
if li==-1: li = -11
if ri==-1: ri = len(s)+11
return min(ti-li, ri-ti) - 1
def ok(n):
strn = str(n)
if any(strn.count(c)==1 for c in set(strn)): return False
for i, c in enumerate(strn):
if nn(i, c, strn) != int(c): return False
return True
for n in range(6*10**6):
if ok(n): print(n, end=", ") # Michael S. Branicky, Dec 17 2020
(PARI) is_A339803(n)={!for(i=1, #n=digits(n), (i>n[i]+1 && n[i-n[i]-1]==n[i])||(i+n[i]<#n && n[i+n[i]+1]==n[i])||return; for(j=max(i-n[i], 1), min(i+n[i], #n), n[j]==n[i] && j!=i && return))} \\ M. F. Hasler, Dec 19 2020
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Dec 17 2020
STATUS
approved