cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A309503 Iteratively replace the sum of two sequentially chosen consecutive integers with those integers.

This page as a plain text file.
%I A309503 #21 Apr 02 2020 00:42:26
%S A309503 1,2,1,2,4,5,2,4,5,2,8,4,5,2,8,11,8,4,13,14,15,16,4,13,4,14,8,11,16,4,
%T A309503 8,13,22,23,24,4,8,13,4,14,8,13,14,24,4,14,15,30,15,16,24,8,33,34,13,
%U A309503 22,36,37,14,24,8,13,4,14,24,16,41,42,8,13,22,44
%N A309503 Iteratively replace the sum of two sequentially chosen consecutive integers with those integers.
%F A309503 To generate the sequence, start with the integers, A_0={1,2,3,4,5,...}. To generate A_{n+1} calculate x = A_n(n) + A_n(n+1). Replace the next instance of x in A_n (after A_n(n+1)) with A_n(n), A_n(n+1). The limit of this process gives the sequence.
%e A309503 A_0 = {1,2,3,4,5,...}.
%e A309503 A_0(0) + A_0(1) = 1 + 2 = 3, which is found after A_0(1), so A_1 = {1,2,1,2,4,5,...}.
%e A309503 A_1(1) + A_1(2) = 2 + 1 = 3, which is *not* found after A_1(2), so A_2 = A_1.
%e A309503 A_2(2) + A_2(3) = 1 + 2 = 3, A_3 = A_2.
%e A309503 A_3(3) + A_3(4) = 2 + 4 = 6, A_4 = {1,2,1,2,4,5,2,4,7,8,9,10,...}.
%e A309503 A_4(4) + A_4(5) = 4 + 5 = 9, A_5 = {1,2,1,2,4,5,2,4,7,8,4,5,10,...}.
%t A309503 T = Range[100]; Do[s = T[[i]] + T[[i + 1]]; Do[If[T[[j]] == s, T = Join[ T[[;; j-1]], {T[[i]], T[[i+1]]}, T[[j+1 ;;]]]; Break[]], {j, i+2, Length@ T}], {i, Length@T}]; T (* _Giovanni Resta_, Sep 20 2019 *)
%o A309503 (Kotlin)
%o A309503 fun generate(len: Int): List<Int> {
%o A309503     fun gen_inner(len: Int, level: Int): List<Int> {
%o A309503         if (level < 1) return (1..len).toList()
%o A309503         val prev = gen_inner(len, level - 1)
%o A309503         if (level == len) return prev.take(len)
%o A309503         val (a, b) = prev[level - 1] to prev[level]
%o A309503         return if (prev.drop(level + 1).contains(a+b)) {
%o A309503             prev.indexOfFirst { it == a+b }.let { idx ->
%o A309503                 prev.take(idx) + a + b + prev.drop(idx + 1)
%o A309503             }
%o A309503         } else prev
%o A309503     }
%o A309503     return gen_inner(len, len)
%o A309503 }
%o A309503 (PARI)
%o A309503 a = vector(92, k, k);
%o A309503 for (n=1, #a-1, s=a[n]+a[n+1]; print1 (a[n] ", "); for (k=n+2, #a - 1, if (a[k]==s, a=concat([a[1..k-1], a[n..n+1], a[k+1..#a]]); break)))
%Y A309503 This sequence is similar to A309435 except it uses addition instead of multiplication.
%K A309503 nonn,easy
%O A309503 1,2
%A A309503 _Matthew Malone_, Aug 05 2019