A379266
a(n) is the number of coincidences of the first n terms of this sequence and the first n terms of A379265 in reverse order, i.e., the number of equalities a(k) = A379265(n-1-k) for 0 <= k < n.
Original entry on oeis.org
0, 1, 0, 2, 0, 1, 1, 2, 1, 0, 3, 1, 0, 2, 0, 2, 2, 2, 2, 3, 3, 3, 1, 0, 3, 2, 3, 3, 4, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 3, 6, 6, 6, 6, 8, 7, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 3, 4, 2, 1, 0, 5, 4, 4, 5, 6, 7, 8, 7, 9, 10, 11, 12, 12, 13, 16, 16, 16, 16, 14, 12
Offset: 0
-
def A379266_list(nterms):
A = []
A379265 = []
for n in range(nterms):
a = sum(1 for x, y in zip(A, reversed(A379265)) if x==y)
if n != 0:
b += (b==A[-1])
else:
b = 0
A.append(a)
A379265.append(b)
return A
Original entry on oeis.org
0, 1, 3, 10, 28, 29, 40, 45, 69, 71, 72, 73, 74, 76, 81, 212, 423, 489, 492, 494, 591, 593, 672, 745, 757, 847, 849, 868, 1178, 1283, 1705, 1902, 1903, 1904, 1905, 1906, 1908, 1911, 1912, 1914, 2243, 2285, 2615, 2616, 3021, 3072, 3074, 3076, 3649, 3682, 3685
Offset: 1
A380188
a(n) is the maximum number of coincidences of the first n terms of this sequence and a cyclic shift of the first n terms of A380189, i.e., the number of equalities a(k) = A380189((s+k) mod n) for 0 <= k < n, maximized over s.
Original entry on oeis.org
0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12
Offset: 0
The first time the shift comes into play is for n = 21. The first 21 terms of this sequence and of A380189 are:
0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
0, 1, 0, 2, 0, 1, 1, 2, 1, 0, 3, 1, 0, 2, 0, 2, 2, 2, 2, 3, 3
^ ^ ^ ^
with only 4 coincidences. But if the second row is shifted 7 steps to the right, we get:
0, 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
0, 2, 2, 2, 2, 3, 3, 0, 1, 0, 2, 0, 1, 1, 2, 1, 0, 3, 1, 0, 2
^ ^ ^ ^ ^
with 5 coincidences. This is the best possible, so a(21) = 5.
A379250
a(1)=1; thereafter, a(n) is the number of coincidences between the sequence thus far and its terms rearranged in descending order.
Original entry on oeis.org
1, 1, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 7, 8, 7, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 6, 6, 8, 8, 10, 10, 11, 12, 12, 13, 12, 12, 11, 12, 12, 11, 12, 12, 12, 12, 12, 12, 11, 11, 10, 11, 9, 9, 7
Offset: 1
To find a(8), we compare the first 7 terms of the sequence with the same terms arranged in descending order:
1, 1, 2, 1, 2, 1, 2
2, 2, 2, 1, 1, 1, 1
^ ^ ^
We find three coincidences, so a(8) = 3.
-
Nest[Append[#,Count[#-Reverse[Sort[#]],0]]&,{1},79] (* James C. McMahon, Dec 21 2024 *)
-
from bisect import insort
from itertools import islice
def agen(): # generator of terms
a, d, an = [], [], 1
while True:
a.append(an)
insort(d, an, key=lambda x: -x)
yield an
an = sum(1 for x, y in zip(a, d) if x == y)
print(list(islice(agen(), 80))) # Michael S. Branicky, Dec 21 2024
Showing 1-4 of 4 results.
Comments