OFFSET
1,2
COMMENTS
Permutation of natural numbers with inverse A210771.
From Jeffrey Shallit, Jun 18 2021: (Start)
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.
It obeys the identities
a(4n+3) = a(2n+1) - a(4n) + 2 a(4n+2)
a(8n) = 2a(4n)
a(8n+1) = a(2n+1) + 3a(4n)
a(8n+2) = a(2n+1) + 2 a(4n) - a(4n+1) + a(4n+2)
a(8n+4) = a(2n+1) + a(4n+2)
a(8n+5) = 3a(2n+1) - a(4n) +2a(4n+2)
a(8n+6) = 2a(2n+1) - a(4n) + a(4n+2). (End)
LINKS
PROG
(Haskell)
import Data.List (delete)
a210770 n = a210770_list !! (n-1)
a210770_list = 1 : 2 : f 1 2 [3..] where
f u v (w:ws) = u' : w : f u' w (delete u' ws) where u' = v + w
(Python)
def aupton(terms):
alst, seen = [1, 2], {1, 2}
for n in range(2, terms, 2):
anp1 = alst[-1] + 1
while anp1 in seen: anp1 += 1
an = alst[n-1] + anp1
alst, seen = alst + [an, anp1], seen | {an, anp1}
return alst[:terms]
print(aupton(67)) # Michael S. Branicky, Jun 18 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Mar 25 2012
EXTENSIONS
Definition corrected by Jeffrey Shallit, Jun 18 2021
STATUS
approved