OFFSET
0,4
COMMENTS
The test is: does the set of digits in a(n-1) intersect the set of digits in a(n-2)?
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..16384
Eric Angelini, Fibostracci, personal blog "Cinquante Signes", blogspot.com, Sep. 30, 2022.
Eric Angelini, Fibostracci [Local copy of blog entry, with permission]
Michael De Vlieger, Log-log scatterplot of a(n), n = 1..2^20, showing a(n) > n in red else dark blue.
EXAMPLE
We start the sequence (call it S) with a(1) = 0 and a(2) = 1. As 0 and 1 share no digit we add them and extend S with the sum: S = 0, 1, 1, ...
As the last two integers share at least one digit, we don't add them and extend S instead with the smallest integer not yet in S:
S = 0, 1, 1, 2, ...
As 1 and 2 share no digit, we add them and extend S with the sum:
S = 0, 1, 1, 2, 3, ...
As 2 and 3 share no digit, we add them and extend S with the sum:
S = 0, 1, 1, 2, 3, 5, ...
Then:
S = 0, 1, 1, 2, 3, 5, 8, 13, 21, ...
As the last two integers share at least one digit, we don't add them and extend S instead with the smallest integer not yet in S:
S = 0, 1, 1, 2, 3, 5, 8, 13, 21, 4, ...
Then:
S = 0, 1, 1, 2, 3, 5, 8, 13, 21, 4, 25, 29, ...
As 25 and 29 share the digit 2, we get:
S = 0, 1, 1, 2, 3, 5, 8, 13, 21, 4, 25, 29, 6, ...
And so on.
MATHEMATICA
nn = 66; c[_] = False; Array[Set[{a[#], c[#]}, {#, True}] &, 2, 0]; i = {a[0]}; j = {a[1]}; u = 2; Do[If[IntersectingQ[i, j], k = u, k = a[n - 2] + a[n - 1]]; Set[{a[n], c[k], i, j}, {k, True, j, IntegerDigits[k]}]; If[k == u, While[c[u], u++]], {n, 2, nn}]; Array[a, nn, 0] (* Michael De Vlieger, Dec 25 2022 *)
PROG
(Python)
from itertools import islice
def agen(): # generator of terms
aset, anm1, an, mink = {0}, 1, 0, 1
while True:
yield an
anm1, an = an, mink if set(str(an)) & set(str(anm1)) else an + anm1
aset.add(an)
while mink in aset: mink += 1
print(list(islice(agen(), 66))) # Michael S. Branicky, Dec 25 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini, Sep 30 2022 [Submitted on his behalf by N. J. A. Sloane, Dec 25 2022]
STATUS
approved