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.

A244040 Sum of digits of n in fractional base 3/2.

This page as a plain text file.
%I A244040 #46 Jul 31 2025 02:39:36
%S A244040 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,
%T A244040 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,
%U A244040 8,8,9,10,8,9,10,9,10,11,11,12,13,10,11,12,5
%N A244040 Sum of digits of n in fractional base 3/2.
%C A244040 The base 3/2 expansion is unique, and thus the sum of digits function is well-defined.
%C A244040 Fixed point starting with 0 of the two-block substitution a,b -> a,a+1,a+2 for a = 0,1,2,... and b = 0,1,2,.... - _Michel Dekking_, Sep 29 2022
%H A244040 Reinhard Zumkeller, <a href="/A244040/b244040.txt">Table of n, a(n) for n = 0..10000</a>
%H A244040 Michel Dekking, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL26/Dekking/dek25.html">The Thue-Morse sequence in base 3/2</a>, J. Int. Seq., Vol. 26 (2023), Article 23.2.3; <a href="https://arxiv.org/abs/2301.13563">arXiv preprint</a>, arXiv:2301.13563 [math.CO], 2023.
%H A244040 <a href="/index/Ba#base_fractional">Index entries for sequences related to fractional bases</a>.
%F A244040 a(0) = 0, a(3n+r) = a(2n)+r for n >= 0 and r = 0, 1, 2. - _David Radcliffe_, Aug 21 2021
%F A244040 a(n) = A007953(A024629(n)). - _Amiram Eldar_, Jul 30 2025
%e A244040 In base 3/2 the number 7 is represented by 211 and so a(7) = 2 + 1 + 1 = 4.
%t A244040 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 *)
%o A244040 (Sage)
%o A244040 def base32sum(n):
%o A244040     L, i = [n], 1
%o A244040     while L[i-1]>2:
%o A244040         x=L[i-1]
%o A244040         L[i-1]=x.mod(3)
%o A244040         L.append(2*floor(x/3))
%o A244040         i+=1
%o A244040     return sum(L)
%o A244040 [base32sum(n) for n in [0..85]]
%o A244040 (Haskell)
%o A244040 a244040 0 = 0
%o A244040 a244040 n = a244040 (2 * n') + t where (n', t) = divMod n 3
%o A244040 -- _Reinhard Zumkeller_, Sep 05 2014
%o A244040 (Python) a244040 = lambda n: a244040((n // 3) * 2) + (n % 3) if n else 0 # _David Radcliffe_, Aug 21 2021
%o A244040 (PARI) a(n) = if(n == 0, 0, a(n\3 * 2) + n % 3); \\ _Amiram Eldar_, Jul 30 2025
%Y A244040 Cf. A024629, A007953, A000120, A053735, A244041, A246435.
%K A244040 nonn,base,easy
%O A244040 0,3
%A A244040 _James Van Alstine_, Jun 17 2014