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.

A246207 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, a(2n) = A117968(a(n)), a(2n+1) = A117967(1+a(n)).

This page as a plain text file.
%I A246207 #25 Jun 07 2017 05:25:22
%S A246207 0,1,2,5,7,3,22,15,23,11,6,4,71,35,66,52,58,33,25,12,21,16,8,17,172,
%T A246207 99,73,36,213,148,194,137,197,152,75,43,59,29,24,13,69,49,68,47,19,9,
%U A246207 64,45,587,419,225,127,173,104,72,37,516,304,620,431,643,447,601,462,640,441,577,423,177,103,203,155,211,150,61,30,57,34,26,53
%N A246207 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, a(2n) = A117968(a(n)), a(2n+1) = A117967(1+a(n)).
%C A246207 This is an instance of entanglement permutation, where complementary pair A005843/A005408 (even and odd numbers respectively) is entangled with complementary pair A117968/A117967 (negative and positive part of inverse of balanced ternary enumeration of integers, respectively), with a(0) set to 0 and a(1) set to 1.
%C A246207 Thus this shares with A140263 the property that after a(0)=0, the even positions contain only terms of A117968 and the odd positions contain only terms of A117967.
%H A246207 Antti Karttunen, <a href="/A246207/b246207.txt">Table of n, a(n) for n = 0..8191</a>
%H A246207 Antti Karttunen, <a href="/A246207/a246207.png">Pin & logarithmic scatter plots computed for range 0..2047 only</a> (computed with OEIS "graph" command)
%H A246207 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A246207 As a composition of related permutations:
%F A246207 a(n) = A246209(A054429(n)).
%F A246207 a(n) = A246211(A246209(n)).
%o A246207 (Scheme, with memoizing definec-macro from _Antti Karttunen_'s IntSeq-library)
%o A246207 (definec (A246207 n) (cond ((<= n 1) n) ((even? n) (A117968 (A246207 (/ n 2)))) (else (A117967 (+ 1 (A246207 (/ (- n 1) 2)))))))
%o A246207 (Python)
%o A246207 from sympy.ntheory.factor_ import digits
%o A246207 def a004488(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3)
%o A246207 def a117968(n):
%o A246207     if n==1: return 2
%o A246207     if n%3==0: return 3*a117968(n/3)
%o A246207     elif n%3==1: return 3*a117968((n - 1)/3) + 2
%o A246207     else: return 3*a117968((n + 1)/3) + 1
%o A246207 def a117967(n): return 0 if n==0 else a117968(-n) if n<0 else a004488(a117968(n))
%o A246207 def a(n): return n if n<2 else a117968(a(n/2)) if n%2==0 else a117967(1 + a((n - 1)/2)) # _Indranil Ghosh_, Jun 07 2017
%Y A246207 Inverse: A246208.
%Y A246207 Related permutations: A140263, A054429, A246209, A246211.
%Y A246207 Cf. A117967, A117968.
%K A246207 nonn,look
%O A246207 0,3
%A A246207 _Antti Karttunen_, Aug 19 2014