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.

A372317 For any n > 0 with leading ternary digit h = A122586(n), reverse digits in blocks in ternary expansion of n where blocks are separated by h's; a(0) = 0.

This page as a plain text file.
%I A372317 #12 Apr 30 2024 14:48:47
%S A372317 0,1,2,3,4,5,6,7,8,9,10,15,12,13,14,11,16,17,18,21,20,19,22,23,24,25,
%T A372317 26,27,28,45,30,31,32,33,46,51,36,37,42,39,40,41,38,43,44,29,34,47,48,
%U A372317 49,50,35,52,53,54,63,56,57,66,65,60,61,62,55,64,59,58,67
%N A372317 For any n > 0 with leading ternary digit h = A122586(n), reverse digits in blocks in ternary expansion of n where blocks are separated by h's; a(0) = 0.
%C A372317 This sequence is a self-inverse permutation of the nonnegative integers.
%C A372317 This sequence has infinitely many fixed points (A125292, among others).
%H A372317 Rémy Sigrist, <a href="/A372317/b372317.txt">Table of n, a(n) for n = 0..6561</a>
%H A372317 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A372317 For n = 5323: the ternary expansion of 5323 is "21022011", the corresponding leading digit is "2", we have three blocks: "10", "" and "011", their reversals are: "01", "" and "110", so the ternary expansion of a(5323) is "20122110", and a(5323) = 4845.
%o A372317 (PARI) a(n, base = 3) = { my (d = digits(n, base), i = 1); for (j = 2, #d+1, if (j==#d+1 || d[i]==d[j], my (ii = i+1, jj = j-1); while (ii < jj, [d[ii], d[jj]] = [d[jj], d[ii]]; ii++; jj--;); i = j;);); fromdigits(d, base); }
%Y A372317 See A367307 and A372318 for similar sequences.
%Y A372317 Cf. A122586, A125292.
%K A372317 nonn,base
%O A372317 0,3
%A A372317 _Rémy Sigrist_, Apr 27 2024