Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #14 Jul 02 2023 20:38:48
%S 0,0,1,1,1,2,1,2,3,1,1,3,2,2,3,3,1,4,4,1,5,2,1,4,6,1,2,5,3,2,7,1,3,5,
%T 4,2,3,8,1,3,6,4,2,4,5,5,3,5,6,2,7,6,1,4,9,2,3,10,3,4,5,7,1,8,8,1,9,4,
%U 5,10,1,4,11,2,6,9,3,2,12,1,7,10,1,5,6,6,3,11,2,8,5,9,3,4,6,6,5
%N a(0) = 0, a(1) = 0; for n > 1, a(n) is the number of pairs of consecutive terms that sum to the same value as a(n-2) + a(n-1).
%C The same number cannot occur four times in a row as the second pair in a triplet of the same numbers increments the appearance count of the first pair by one, so the fourth number is always one more than the previous three numbers.
%C The occurrences of three consecutive equal numbers is quite rare, only occurring thirteen times in the first 20 million terms. The last such triplet is a(3641208) = a(3641209) = a(3641210) = 1177. It is likely such triplets occur infinitely often although this is unknown.
%H Michael De Vlieger, <a href="/A364027/b364027.txt">Table of n, a(n) for n = 0..10000</a>
%H Scott R. Shannon, <a href="/A364027/a364027_1.png">Image of the first 20 million terms</a>.
%e a(2) = 1 as there is one pair that sums to a(0) + a(1) = 0, namely a(0) + a(1).
%e a(4) = 1 as a(2) + a(3) = 1 + 1 = 2, and there has been one previous pair that also sums to 2, namely a(2) + a(3).
%e a(5) = 2 as a(3) + a(4) = 1 + 1 = 2, and there has been two previous pairs that also sums to 2, namely a(2) + a(3) and a(3) + a(4).
%t nn = 120; c[_] := 0; a[0] = a[1] = i = j = 0; Do[Set[k, 1 + c[i + j]++]; i = j; j = a[n] = k, {n, 2, nn}]; Array[a, nn + 1, 0] (* _Michael De Vlieger_, Jul 02 2023 *)
%o (Python)
%o def A364027_gen(): # generator of terms
%o a, b, ndict = 0, 0, {0:1}
%o yield from (0,0)
%o while True:
%o a, b = b, ndict[a+b]
%o yield b
%o ndict[a+b] = ndict.get(a+b,0)+1 # _Chai Wah Wu_, Jul 02 2023
%Y Cf. A364036 (do not include previous pair), A342585, A347062.
%K nonn,look
%O 0,6
%A _Scott R. Shannon_, Jul 01 2023