|
|
A043489
|
|
Numbers having one 0 in base 10.
|
|
14
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Inversion:
Given a term m, the index n such that a(n) = m can be calculated by the following procedure [see Prog section with an implementation in Smalltalk]. With k := floor(log_10(m)), z = digit position of the '0' in m counted from the right (starting with 0).
Case 1: A043489_inverse(m) = 1 + Sum_{j=1..k} A052382_inverse(floor(m/10^j))*9^(j-1), if z = 0.
Case 2: A043489_inverse(m) = 1 + A043489_inverse(m - c - m mod 10^z) + A052382_inverse(m mod 10^z)) - (9^z - 1)/8, if z > 0, where c := 1, if the digit at position z+1 of m is ‘1’ and k > z + 1, otherwise c := 10.
Example 1: m = 990, k = 2, z = 0 (Case 1), A043489_inverse(990) = 1 + A052382_inverse(99))*1 + A052382_inverse(9))*9 = 1 + 90 + 81 = 172.
Example 2: m = 1099, k = 3, z = 2 (Case 2), A043489_inverse(1099) = 1 + A043489_inverse(990) + A052382_inverse(99)) - 10 = 1 + A043489_inverse(990) + 80 = 1 + 172 + 80 = 253.
(End)
|
|
LINKS
|
|
|
FORMULA
|
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)
|
|
EXAMPLE
|
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.
|
|
MATHEMATICA
|
|
|
PROG
|
(Smalltalk)
"Answers the minimal number > m which contains exactly 1 zero digit (in base 10), where m is the receiver.
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
------------------
(Smalltalk)
"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.
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
------------------
(Smalltalk)
"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].
ifFalse:
[s := 1.
p := 10.
q := 1.
[p < m] whileTrue:
[s := (m // p) A052382_inverse * q + s.
p := 10 * p.
q := 9 * q].
^s]
|
|
CROSSREFS
|
Cf. A043493, A043497, A043501, A043505, A043509, A043513, A043517, A043521, A043525, A011540, A052382.
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|