A244040 Sum of digits of n in fractional base 3/2.
0, 1, 2, 2, 3, 4, 3, 4, 5, 3, 4, 5, 5, 6, 7, 4, 5, 6, 5, 6, 7, 7, 8, 9, 5, 6, 7, 5, 6, 7, 7, 8, 9, 8, 9, 10, 5, 6, 7, 7, 8, 9, 6, 7, 8, 7, 8, 9, 9, 10, 11, 9, 10, 11, 5, 6, 7, 7, 8, 9, 8, 9, 10, 6, 7, 8, 8, 9, 10, 8, 9, 10, 9, 10, 11, 11, 12, 13, 10, 11, 12, 5
Offset: 0
Examples
In base 3/2 the number 7 is represented by 211 and so a(7) = 2 + 1 + 1 = 4.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Michel Dekking, The Thue-Morse sequence in base 3/2, J. Int. Seq., Vol. 26 (2023), Article 23.2.3; arXiv preprint, arXiv:2301.13563 [math.CO], 2023.
- Index entries for sequences related to fractional bases.
Programs
-
Haskell
a244040 0 = 0 a244040 n = a244040 (2 * n') + t where (n', t) = divMod n 3 -- Reinhard Zumkeller, Sep 05 2014
-
Mathematica
a[n_]:= a[n]= If[n==0, 0, a[2*Floor[n/3]] + Mod[n,3]]; Table[a[n], {n, 0, 85}] (* G. C. Greubel, Aug 20 2019 *)
-
PARI
a(n) = if(n == 0, 0, a(n\3 * 2) + n % 3); \\ Amiram Eldar, Jul 30 2025
-
Python
a244040 = lambda n: a244040((n // 3) * 2) + (n % 3) if n else 0 # David Radcliffe, Aug 21 2021
-
Sage
def base32sum(n): L, i = [n], 1 while L[i-1]>2: x=L[i-1] L[i-1]=x.mod(3) L.append(2*floor(x/3)) i+=1 return sum(L) [base32sum(n) for n in [0..85]]
Formula
a(0) = 0, a(3n+r) = a(2n)+r for n >= 0 and r = 0, 1, 2. - David Radcliffe, Aug 21 2021
Comments