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.

A264985 Self-inverse permutation of nonnegative integers: a(n) = (A264983(n)-1) / 2.

This page as a plain text file.
%I A264985 #17 May 22 2017 20:07:49
%S A264985 0,1,3,2,4,9,6,10,12,5,7,11,8,13,27,18,28,36,15,19,33,24,31,30,21,37,
%T A264985 39,14,16,32,23,22,29,20,34,38,17,25,35,26,40,81,54,82,108,45,55,99,
%U A264985 72,85,90,63,109,117,42,46,96,69,58,87,60,100,114,51,73,105,78,94,84,57,91,111,48,64,102,75,112,93,66,118,120,41
%N A264985 Self-inverse permutation of nonnegative integers: a(n) = (A264983(n)-1) / 2.
%H A264985 Antti Karttunen, <a href="/A264985/b264985.txt">Table of n, a(n) for n = 0..9841</a>
%H A264985 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A264985 a(n) = (A264983(n)-1) / 2 = (1/2) * (A263273(2n + 1) - 1).
%t A264985 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]]]; t = Select[f /@ Range@ 1000, OddQ]; Table[(t[[n + 1]] - 1)/2, {n, 0, 81}] (* _Michael De Vlieger_, Jan 04 2016, after _Jean-François Alcover_ at A263273 *)
%o A264985 (Scheme) (define (A264985 n) (/ (- (A264983 n) 1) 2))
%o A264985 (Python)
%o A264985 from sympy import factorint
%o A264985 from sympy.ntheory.factor_ import digits
%o A264985 from operator import mul
%o A264985 def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
%o A264985 def a038502(n):
%o A264985     f=factorint(n)
%o A264985     return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
%o A264985 def a038500(n): return n/a038502(n)
%o A264985 def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n)
%o A264985 def a(n): return (a263273(2*n + 1) - 1)/2 # _Indranil Ghosh_, May 22 2017
%Y A264985 Cf. A263273, A264983.
%Y A264985 Cf. also A264989, A264991, A264992.
%K A264985 nonn
%O A264985 0,3
%A A264985 _Antti Karttunen_, Dec 05 2015