OFFSET
1,2
COMMENTS
a(1) = 1 is the first number in the sequence because it is the first positive integer that has a reciprocal, whereas zero has no definite result (infinity) for its reciprocal.
If any other positive integer is used as a(1) (for example, a(1) = 5), the resulting terms will follow the original sequence after a few cycles of adding and flooring.
Example:
b(1) = 5,
b(2) = 5+floor(10/5) = 7,
b(3) = 7+floor(10/7) = 8, which is a(4) in the original sequence.
Also, if any negative integer is used as a(1) (and the condition is adjusted to -1 <= ceiling(10^k/a(n-1) < -10), the same happens, except that the resulting terms will be negative.
Example:
c(1) = -1,
c(2) = -1+ceiling(1/-1) = -2,
c(3) = -2+ceiling(10/-2) = -7, which is the negative of a(3) in the original sequence.
Also,
d(1) = -5,
d(2) = -5+ceiling(10/-5) = -7,
d(3) = -7+ceiling(10/-7) = -8, which is the negative of a(4) in the original sequence.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
a(n) + 1 <= a(n+1) <= a(n) + 9, hence n <= a(n) <= 9n. - Charles R Greathouse IV, Jun 18 2015
EXAMPLE
a(1) = 1;
a(2) = 1 + floor(10^0/a(1)) = 2 with a(1) = 10^0;
a(3) = 2 + floor(10/a(2)) = 7 with 1 < a(2) < 10;
...
a(7) = 10 + floor(10/a(6)) = 11 with a(6) = 10;
a(8) = 11 + floor(10^2/a(7)) = 20 with 10 < a(7) < 10^2.
MATHEMATICA
f[n_] := Block[{a = {1}, i, k}, For[i = 2, i <= n, i++, k = 0; While[10^k < a[[i - 1]], k++]; AppendTo[a, a[[i - 1]] + Floor[10^k/a[[i - 1]]]]]; a]; f@ 70 (* Michael De Vlieger, Jun 19 2015 *)
PROG
(C)
// Input: a(n), Output: a(n+1)
int A253251 (int a) {
int t=1, r=0;
while (t/a==0) {
t*=10;
}
r=t/a;
return r+a;
}
(PARI) first(n)=my(v=vector(n, i, 1), N=1, k=1); for(i=2, n, if(k>N, N*=10); v[i]=k+=N\k); v \\ Charles R Greathouse IV, Jun 18 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Arlu Genesis A. Padilla, Jun 05 2015
STATUS
approved