OFFSET
1,2
LINKS
Eric M. Schmidt, Table of n, a(n) for n = 1..10000
EXAMPLE
L_n for 1,...,5 are: {2}, {2,3}, {2,3,5}, {2,3,5,7}, {2,3,5,7,11}, so that a(i) = i for i = 1,...,5. Prime(6) = 13 can be appended to the beginning of 3 (in L_5) so that their neighboring digits (i.e. 3s) are equal. Hence L_6 = {2,133,5,7,11} and a(6) = 5. Prime(7) = 17 can be appended to the beginning of 7 in L_6 so that their neighboring digits are equal; so L_7 = {2,133,5,177,11} and a(7) = 5. It would be interesting to have a closed-form expression giving, at least asymptotically or statistically, the value of a(n).
PROG
(SageMath)
def a_list(n) :
res = []
curlist = []
for m in range(1, n+1) :
d = nth_prime(m).digits()
ds = [d[-1], d[0]]
matcheditem = false
for i in range(len(curlist)) :
if curlist[i][0] == ds[1] :
curlist[i][0] = ds[0]
matcheditem = true
break
if curlist[i][1] == ds[0] :
curlist[i][1] = ds[1]
matcheditem = true
break
if not matcheditem : curlist.append(ds)
res.append(len(curlist))
return res
# Eric M. Schmidt, Oct 20 2016
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Joseph L. Pe, Feb 15 2002
EXTENSIONS
Extended and corrected by Eric M. Schmidt, Oct 20 2016
STATUS
approved
