A189717 Partial sums of A156595.
0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12, 12, 13, 14, 14, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19, 20, 20, 21, 21, 21, 22, 23, 23, 24, 25, 25, 26, 26, 26, 27, 27, 27, 28, 29, 29, 30, 30, 30, 31, 31, 31, 32, 33, 33, 34, 34, 34, 35, 36, 36, 37, 38, 38, 39, 39, 39, 40, 40
Offset: 1
Keywords
Links
- Andrew Howroyd, Table of n, a(n) for n = 1..10000
- Kevin Ryde, Iterations of the Terdragon Curve, see index "AltTurnsR".
Programs
-
Mathematica
(See A189715.)
-
PARI
a(n) = {if(n<=0, 0, (n+1)\3 + n\3 - a(n\3))} \\ Andrew Howroyd, Sep 10 2019
-
PARI
a(n) = (n - subst(Pol(digits(n,3)%2),'x,-1))/2; \\ Kevin Ryde, Jul 18 2021
-
Python
from sympy import integer_log def A189717(n): return sum(((m:=n//9**i)-2)//9+(m-3)//9+(m-5)//9+(m-8)//9+4 for i in range(integer_log(n,9)[0]+1)) # Chai Wah Wu, Feb 15 2025
Formula
a(n) = floor((n+1)/3) + floor(n/3) - a(floor(n/3)), with a(0) = 0.
Comments