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.

A115303 a(n) = n if n < 3, otherwise 3*a(floor(n/3)) + 2 - n mod 3.

This page as a plain text file.
%I A115303 #22 May 24 2024 08:41:21
%S A115303 1,2,5,4,3,8,7,6,17,16,15,14,13,12,11,10,9,26,25,24,23,22,21,20,19,18,
%T A115303 53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,
%U A115303 30,29,28,27,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62
%N A115303 a(n) = n if n < 3, otherwise 3*a(floor(n/3)) + 2 - n mod 3.
%C A115303 Self-inverse permutation of the natural numbers.
%C A115303 if n is written in ternary representation, then a(n) is the value after replacing all digits d (but not the leading one) with 2-d.
%C A115303 a(n+1) = a(n)-1 unless n = 3^k - 1 or 2*3^k-1 for some k. - _Robert Israel_, Feb 28 2023
%H A115303 Robert Israel, <a href="/A115303/b115303.txt">Table of n, a(n) for n = 1..10000</a>
%H A115303 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A115303 a(n) = A115310(n+1,2).
%p A115303 a:= proc(n) option remember;
%p A115303    3*procname(floor(n/3))+2 - (n mod 3)
%p A115303 end proc:
%p A115303 a(1):= 1: a(2):= 2:
%p A115303 map(a, [$1..100]); # _Robert Israel_, Feb 28 2023
%t A115303 A115303[n_] := FromDigits[MapAt[2 - # &, IntegerDigits[n, 3], 2;;], 3];
%t A115303 Array[A115303, 100] (* _Paolo Xausa_, May 20 2024 *)
%Y A115303 Cf. A054429, A115304, A115305, A115306, A115307, A115308, A115309, A106649.
%K A115303 nonn,base,look
%O A115303 1,2
%A A115303 _Reinhard Zumkeller_, Jan 20 2006