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.

A210770 a(1) = 1, a(2) = 2; for n > 1, a(2*n+2) = smallest number not yet seen, a(2*n+1) = a(2*n) + a(2*n+2).

This page as a plain text file.
%I A210770 #23 Jun 19 2021 02:36:27
%S A210770 1,2,5,3,7,4,10,6,14,8,17,9,20,11,23,12,25,13,28,15,31,16,34,18,37,19,
%T A210770 40,21,43,22,46,24,50,26,53,27,56,29,59,30,62,32,65,33,68,35,71,36,74,
%U A210770 38,77,39,80,41,83,42,86,44,89,45,92,47,95,48,97,49,100
%N A210770 a(1) = 1, a(2) = 2; for n > 1, a(2*n+2) = smallest number not yet seen, a(2*n+1) = a(2*n) + a(2*n+2).
%C A210770 Permutation of natural numbers with inverse A210771.
%C A210770 From _Jeffrey Shallit_, Jun 18 2021: (Start)
%C A210770 This sequence is "2-sychronized"; there is a 23-state finite automaton that recognizes the base-2 representations of n and a(n), in parallel.
%C A210770 It obeys the identities
%C A210770 a(4n+3) = a(2n+1) - a(4n) + 2 a(4n+2)
%C A210770 a(8n) = 2a(4n)
%C A210770 a(8n+1) = a(2n+1) + 3a(4n)
%C A210770 a(8n+2) = a(2n+1) + 2 a(4n) - a(4n+1) + a(4n+2)
%C A210770 a(8n+4) = a(2n+1) + a(4n+2)
%C A210770 a(8n+5) = 3a(2n+1) - a(4n) +2a(4n+2)
%C A210770 a(8n+6) = 2a(2n+1) - a(4n) + a(4n+2). (End)
%H A210770 Reinhard Zumkeller, <a href="/A210770/b210770.txt">Table of n, a(n) for n = 1..10000</a>
%H A210770 <a href="/index/Per#IntegerPermutation"> Index entries for sequences that are permutations of the natural numbers</a>
%F A210770 a(2*n-1) = A022441(n-1); a(2*n) = A055562(n-1).
%o A210770 (Haskell)
%o A210770 import Data.List (delete)
%o A210770 a210770 n = a210770_list !! (n-1)
%o A210770 a210770_list = 1 : 2 : f 1 2 [3..] where
%o A210770    f u v (w:ws) = u' : w : f u' w (delete u' ws) where u' = v + w
%o A210770 (Python)
%o A210770 def aupton(terms):
%o A210770     alst, seen = [1, 2], {1, 2}
%o A210770     for n in range(2, terms, 2):
%o A210770         anp1 = alst[-1] + 1
%o A210770         while anp1 in seen: anp1 += 1
%o A210770         an = alst[n-1] + anp1
%o A210770         alst, seen = alst + [an, anp1], seen | {an, anp1}
%o A210770     return alst[:terms]
%o A210770 print(aupton(67)) # _Michael S. Branicky_, Jun 18 2021
%Y A210770 Cf. A064736.
%K A210770 nonn
%O A210770 1,2
%A A210770 _Reinhard Zumkeller_, Mar 25 2012
%E A210770 Definition corrected by _Jeffrey Shallit_, Jun 18 2021