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.

A261691 Change of base from fractional base 3/2 to base 3.

This page as a plain text file.
%I A261691 #18 Aug 04 2025 02:18:20
%S A261691 0,1,2,6,7,8,21,22,23,63,64,65,69,70,71,192,193,194,207,208,209,213,
%T A261691 214,215,579,580,581,621,622,623,627,628,629,642,643,644,1737,1738,
%U A261691 1739,1743,1744,1745,1866,1867,1868,1881,1882,1883,1887,1888,1889,1929,1930
%N A261691 Change of base from fractional base 3/2 to base 3.
%C A261691 To obtain a(n), we interpret A024629(n) as a base 3 representation (instead of base 3/2). More precisely, if A024629(n) = A007089(m), then a(n) = m.
%C A261691 The digits used in fractional base 3/2 are 0, 1, and 2, which are the same as the digits used in base 3.
%H A261691 Rémy Sigrist, <a href="/A261691/b261691.txt">Table of n, a(n) for n = 0..10000</a>
%H A261691 <a href="/index/Ba#base_fractional">Index entries for sequences related to fractional bases</a>.
%F A261691 For n = Sum_{i=0..m} c_i*(3/2)^i with each c_i in {0,1,2}, a(n) = Sum_{i=0..m} c_i*3^i.
%F A261691 From _Rémy Sigrist_, Apr 06 2021: (Start)
%F A261691 Apparently:
%F A261691 - a(3*n) = a(3*n-1) + A003462(1+A087088(n)) for any n > 0,
%F A261691 - a(3*n+1) = a(3*n) + 1 for any n >= 0,
%F A261691 - a(3*n+2) = a(3*n+1) + 1 for any n >= 0,
%F A261691 (End)
%e A261691 The base 3/2 representation of 7 is (2,1,1); i.e., 7 = 2*(3/2)^2 + 1*(3/2) + 1. Since 2*(3^2) + 1*3 + 1*1 = 22, we have a(7) = 22.
%t A261691 a[n_] := a[n] = If[n == 0, 0, 3 * a[2 * Floor[n/3]] + Mod[n, 3]]; Array[a, 100, 0] (* _Amiram Eldar_, Aug 04 2025 *)
%o A261691 (Sage)
%o A261691 def changebase(n):
%o A261691     L=[n]
%o A261691     i=1
%o A261691     while L[i-1]>2:
%o A261691         x=L[i-1]
%o A261691         L[i-1]=x.mod(3)
%o A261691         L.append(2*floor(x/3))
%o A261691         i+=1
%o A261691     return sum([L[i]*3^i for i in [0..len(L)-1]])
%o A261691 [changebase(n) for n in [0..100]]
%o A261691 (PARI) a(n) = { my (v=0, t=1); while (n, v+=t*(n%3); n=(n\3)*2; t*=3); v } \\ _Rémy Sigrist_, Apr 06 2021
%Y A261691 Cf. A024629, A007089.
%Y A261691 Cf. A005836, A023717, A000695, A037453, A037454, A037455, A037456, A037314.
%Y A261691 Cf. A003462, A087088.
%K A261691 nonn,base,easy
%O A261691 0,3
%A A261691 _Tom Edgar_, Aug 28 2015