A043489 Numbers having one 0 in base 10.
0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 120, 130, 140, 150, 160, 170, 180, 190, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 220, 230, 240, 250, 260, 270, 280, 290, 301, 302, 303
Offset: 1
Examples
a(10^1)= 90. a(10^2)= 590. a(10^3)= 4190. a(10^4)= 35209. a(10^5)= 308949. a(10^6)= 2901559. a(10^7)= 27250269. a(10^8)= 263280979. a(10^9)= 2591064889. a(10^10)= 25822705899. a(10^20)= 366116331598324670219. a(10^50)= 3.7349122484477433715662812...*10^51 a(10^100)= 4.4588697999177752943575344...*10^103. a(10^1000)= 5.5729817962143143812258616...*10^1045. [Examples by _Hieronymus Fischer_, May 28 2014]
Links
- Enrique Pérez Herrero and Hieronymus Fischer [terms 1..2000 from Enrique Pérez Herrero], Table of n, a(n) for n = 1..10000
- Index entries for 10-automatic sequences.
Crossrefs
Programs
-
Mathematica
Select[Range[0,9000],DigitCount[#,10,0]==1&] (* Enrique Pérez Herrero, Nov 29 2013 *)
-
PARI
is(n)=#select(d->d==0, digits(n))==1 \\ Charles R Greathouse IV, Oct 06 2016
-
Smalltalk
A043489_nextTerm "Answers the minimal number > m which contains exactly 1 zero digit (in base 10), where m is the receiver. Usage: a(n) A043489_nextTerm Answer: a(n+1)" | d d0 s n p | n := self. p := 1. s := n. (d0 := n // p \\ 10) = 0 ifTrue: [p := 10 * p. s := s + 1]. [(d := n // p \\ 10) = 9] whileTrue: [s := s - (8 * p). p := 10 * p]. (d = 0 or: [d0 = 0]) ifTrue: [s := s - (p // 10)]. ^s + p [by Hieronymus Fischer, May 28 2014] ------------------
-
Smalltalk
A043489 "Answers the n-th number such that number of 0's in base 10 is 1, where n is the receiver. Uses the method zerofree: base from A052382. Usage: n A043489 Answer: a(n)" | n a b dj cj gj ej j r | n := self. n <= 1 ifTrue: [^r := 0]. n <= 10 ifTrue: [^r := (n - 1) * 10]. j := n invGeometricSum2: 9. b := j geometricSum2: 9. cj := 9 ** j. dj := (j + 1) * cj. gj := (cj - 1) / 8. ej := 10 ** j. a := n - b - 2. b := a \\ dj. r := (a // dj + 1) * ej * 10. [b >= cj] whileTrue: [a := b - cj. cj := cj // 9. dj := j * cj. b := a \\ dj. r := (a // dj + 1) * ej + r. gj := gj - cj. ej := ej // 10. j := j - 1]. r := (b + gj zerofree: 10) + r. ^r [by Hieronymus Fischer, May 28 2014] ------------------
-
Smalltalk
A043489_inverse "Answers the index n such that A043489(n) = m, where m is the receiver. Uses A052382_inverse from A052382. Usage: n zerofree_inverse: b [b = 10 for this sequence] Answer: a(n)" | m p q s r m1 mr | m := self. m < 100 ifTrue: [^m // 10 + 1]. p := q := 1. s := 0. [m // p \\ 10 = 0] whileFalse: [p := 10 * p. s := s + q. q := 9 * q]. p > 1 ifTrue: [r := m \\ p. p := 10 * p. m1 := m // p. (m1 \\ 10 = 1 and: [m1 > 10]) ifTrue: [mr := m - r - 1] ifFalse: [mr := m - r - 10]. ^mr A043489_inverse + r A052382_inverse - s + 1] ifFalse: [s := 1. p := 10. q := 1. [p < m] whileTrue: [s := (m // p) A052382_inverse * q + s. p := 10 * p. q := 9 * q]. ^s] [by Hieronymus Fischer, May 28 2014]
Formula
From Hieronymus Fischer, May 28 2014: (Start)
a(1 + Sum_{j=1..n} j*9^j) = 10*(10^n - 1).
a(2 + Sum_{j=1..n} j*9^j) = 10^(n+1) + (10^n - 1)/9 = (91*10^n - 1)/9.
a((9^(n+1) - 1)/8 + 1 + Sum_{j=1..n} j*9^j) = 10*(10^(n+1) - 1)/9, where Sum_{j=1..n} j*9^j = (1-(n+1)*9^n+n*9^(n+1))*9/64.
Iterative calculation:
With i := digit position of the '0' in a(n) counted from the right (starting with 0), j = number of contiguous '9' digits in a(n) counted from position 1, if i = 0, and counted from position 0, if i > 0 (0 if none)
a(n+1) = a(n) + 10 + (10^j - 1)/9, if i = 0.
a(n+1) = a(n) + 1 + (10^(j-1) - 1)/9, if i = j > 0.
a(n+1) = a(n) + 1 + (10^j - 1)/9, if i > j.
[see Prog section for an implementation in Smalltalk].
Direct calculation:
Set j := max( m | (Sum_{i=1..m} i*9^i) < n) and c(1) := n - 2 - Sum_{i=1..j} i*9^i. Define successively,
c(i+1) = c(i) mod ((j-i+2)*9^(j-i+1)) - 9^(j-i+1) while this value is >= 0, and set k := i for the last such index for which c(i) >= 0.
Then a(n) = A052382(c(k) mod ((j-k+2)*9^(j-k+1)) + (9^(j-k+1)-1)/8) + Sum_{i=1..k} ((floor(c(i)/((j-i+2)*9^(j-i+1))) + 1) * 10^(j-i+2)). [see Prog section for an implementation in Smalltalk].
Behavior for large n:
a(n) = O(n^(log(10)/log(9))/log(n)).
a(n) = O(n^1.047951651.../log(n)).
Inequalities:
a(n) < 2*(8n)^log_9(10)/(log_9(8n)*log_9(10)).
a(n) < (8n)^log_9(10)/(log_9(8n)*log_9(10)), for large n (n > 10^50).
a(n) > 0.9*(8n)^log_9(10)/(log_9(8n)*log_9(10)), for 2 < n < 10^50.
a(n) >= A011540(n), equality holds for n <= 10.
(End)
Comments