A145204 Numbers whose representation in base 3 (A007089) ends in an odd number of zeros.
0, 3, 6, 12, 15, 21, 24, 27, 30, 33, 39, 42, 48, 51, 54, 57, 60, 66, 69, 75, 78, 84, 87, 93, 96, 102, 105, 108, 111, 114, 120, 123, 129, 132, 135, 138, 141, 147, 150, 156, 159, 165, 168, 174, 177, 183, 186, 189, 192, 195, 201, 204, 210, 213, 216, 219, 222, 228, 231
Offset: 1
Keywords
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- Aviezri S. Fraenkel, The vile, dopey, evil and odious game players, Discrete Math. 312 (2012), no. 1, 42-46.
- Index entries for 3-automatic sequences.
Crossrefs
Programs
-
Haskell
a145204 n = a145204_list !! (n-1) a145204_list = 0 : map (+ 1) (findIndices even a051064_list) -- Reinhard Zumkeller, May 23 2013
-
Maple
isA145204 := proc(n) local d, c; if n = 0 then return true fi; d := A007089(n); c := 0; while irem(d, 10) = 0 do c := c+1; d := iquo(d, 10) od; type(c, odd) end: select(isA145204, [$(0..231)]); # Peter Luschny, Aug 05 2020
-
Mathematica
Select[ Range[0, 235], (# // IntegerDigits[#, 3]& // Split // Last // Count[#, 0]& // OddQ)&] (* Jean-François Alcover, Mar 18 2013 *) Join[{0}, Select[Range[235], OddQ @ IntegerExponent[#, 3] &]] (* Amiram Eldar, Sep 20 2020 *)
-
Python
import numpy as np def isA145204(n): if n == 0: return True c = 0 d = int(np.base_repr(n, base = 3)) while d % 10 == 0: c += 1 d //= 10 return c % 2 == 1 print([n for n in range(231) if isA145204(n)]) # Peter Luschny, Aug 05 2020
-
Python
from sympy import integer_log def A145204(n): if n == 1: return 0 def bisection(f,kmin=0,kmax=1): while f(kmax) > kmax: kmax <<= 1 kmin = kmax >> 1 while kmax-kmin > 1: kmid = kmax+kmin>>1 if f(kmid) <= kmid: kmax = kmid else: kmin = kmid return kmax def f(x): return n-1+sum(((m:=x//9**i)-2)//3+(m-1)//3+2 for i in range(integer_log(x,9)[0]+1)) return bisection(f,n,n) # Chai Wah Wu, Feb 15 2025
Formula
a(n) = 3 * A007417(n-1) for n > 1.
A014578(a(n)) = 0.
For n > 1, A007949(a(n)) mod 2 = 1. [Edited by Peter Munn, Aug 02 2020]
{a(n) : n >= 2} = {A052330(A042964(k)) : k >= 1} = {A064614(A036554(k)) : k >= 1}. - Peter Munn, Aug 31 2019 and Dec 06 2020
Extensions
New name using a comment of Vladimir Shevelev by Peter Luschny, Aug 05 2020
Comments