OFFSET
1,2
COMMENTS
It appears that a(n) is growing slowly on the average. (A moving average filter applied to the sequence will show an upward trend.) Probably a(n) > 0 for all n, but lacking a proof, one is never sure. For example, L_9 = {5} comes perilously close to extinction. It would be interesting to have a closed-form expression giving, at least asymptotically, the value of a(n).
LINKS
Eric M. Schmidt, Table of n, a(n) for n = 1..10000
EXAMPLE
L_n for n = 1..5 are: {2}, {2,3}, {2,3,5}, {2,3,5,7}, {2,3,5,7,11}. The first five values of the sequence are then 1,2,3,4,5, respectively. For n = 6, Prime(6) = 13 can be appended to the beginning of 3 in L_5 so that the neighboring digits (i.e., 3's) are equal, so eliminate 3 from L_5 to get L_6 = {2,5,7,11}. Hence a(6) = 4.
PROG
(Sage)
def a_list(n) :
res = []
curlist = []
for m in range(1, n+1) :
d = nth_prime(m).digits()
ds = (d[-1], d[0])
remitem = next((i for i in range(len(curlist)) if curlist[i][0] == ds[1] or curlist[i][1] == ds[0]), None)
if remitem != None : del curlist[remitem]
else : curlist.append(ds)
res.append(len(curlist))
return res
# Eric M. Schmidt, Oct 19 2016
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Joseph L. Pe, Feb 13 2002
EXTENSIONS
Extended and corrected and definition edited by Eric M. Schmidt, Oct 19 2016
STATUS
approved