A253251 a(1) = 1, and for n > 0, a(n+1) = a(n) + floor(10^k/a(n)), where k is the least integer such that 10^k >= a(n).
1, 2, 7, 8, 9, 10, 11, 20, 25, 29, 32, 35, 37, 39, 41, 43, 45, 47, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101
Offset: 1
Keywords
Examples
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.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
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; }
-
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 *)
-
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
Formula
a(n) + 1 <= a(n+1) <= a(n) + 9, hence n <= a(n) <= 9n. - Charles R Greathouse IV, Jun 18 2015
Comments