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.

A266189 Self-inverse permutation of nonnegative integers: a(n) = A263273(A264985(A263273(n))).

This page as a plain text file.
%I A266189 #11 May 22 2017 20:08:14
%S A266189 0,1,3,2,4,10,6,9,12,7,5,11,8,13,37,24,28,31,21,19,57,18,27,30,15,36,
%T A266189 39,22,16,34,23,17,35,69,29,32,25,14,38,26,40,118,78,109,112,75,46,
%U A266189 100,72,82,91,51,85,94,66,64,192,20,73,219,60,171,138,63,55,165,54,81,84,33,90,111,48,58,174,45,108,93,42,117,120,67,49
%N A266189 Self-inverse permutation of nonnegative integers: a(n) = A263273(A264985(A263273(n))).
%H A266189 Antti Karttunen, <a href="/A266189/b266189.txt">Table of n, a(n) for n = 0..6561</a>
%H A266189 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A266189 a(n) = A263273(A264985(A263273(n))).
%F A266189 As a composition of related permutations:
%F A266189 a(n) = A263273(A265353(n)).
%F A266189 a(n) = A265354(A263273(n)).
%t A266189 f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; s = Select[f /@ Range@ 5000, OddQ]; t = Table[(s[[n + 1]] - 1)/2, {n, 0, 1000}]; Table[f@ t[[f@ n + 1]], {n, 0, 82}] (* _Michael De Vlieger_, Jan 04 2016, after _Jean-François Alcover_ at A263273 *)
%o A266189 (Scheme) (define (A266189 n) (A263273 (A264985 (A263273 n))))
%o A266189 (Python)
%o A266189 from sympy import factorint
%o A266189 from sympy.ntheory.factor_ import digits
%o A266189 from operator import mul
%o A266189 def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
%o A266189 def a038502(n):
%o A266189     f=factorint(n)
%o A266189     return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
%o A266189 def a038500(n): return n/a038502(n)
%o A266189 def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
%o A266189 def a264985(n): return (a263273(2*n + 1) - 1)/2
%o A266189 def a(n): return a263273(a264985(a263273(n))) # _Indranil Ghosh_, May 22 2017
%Y A266189 Cf. A263273, A264985, A265353, A265354.
%Y A266189 Cf. also A265902, A266190.
%K A266189 nonn,base
%O A266189 0,3
%A A266189 _Antti Karttunen_, Jan 02 2016