login
A359128
The Fibostracci sequence: a(0) = 0, a(1) = 1; thereafter a(n) = a(n-1)+a(n-2) if a(n-1) and a(n-2) do not share a digit, otherwise a(n) is the smallest number not yet in the sequence.
2
0, 1, 1, 2, 3, 5, 8, 13, 21, 4, 25, 29, 6, 35, 41, 76, 117, 7, 9, 16, 25, 41, 66, 107, 173, 10, 11, 12, 14, 15, 17, 18, 19, 20, 39, 59, 22, 81, 103, 23, 24, 26, 27, 28, 30, 58, 88, 31, 119, 32, 151, 183, 33, 34, 36, 37, 38, 40, 78, 118, 42, 160, 202, 43, 245, 44
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
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
Sequence in context: A093093 A345095 A281408 * A327451 A137290 A268962
KEYWORD
nonn,base
AUTHOR
Eric Angelini, Sep 30 2022 [Submitted on his behalf by N. J. A. Sloane, Dec 25 2022]
STATUS
approved