cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

This page as a plain text file.
%I A253251 #39 Feb 28 2025 23:11:42
%S A253251 1,2,7,8,9,10,11,20,25,29,32,35,37,39,41,43,45,47,49,51,52,53,54,55,
%T A253251 56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,
%U A253251 79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101
%N 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).
%C A253251 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.
%C A253251 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.
%C A253251 Example:
%C A253251   b(1) = 5,
%C A253251   b(2) = 5+floor(10/5) = 7,
%C A253251   b(3) = 7+floor(10/7) = 8, which is a(4) in the original sequence.
%C A253251 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.
%C A253251 Example:
%C A253251   c(1) = -1,
%C A253251   c(2) = -1+ceiling(1/-1) = -2,
%C A253251   c(3) = -2+ceiling(10/-2) = -7, which is the negative of a(3) in the original sequence.
%C A253251 Also,
%C A253251   d(1) = -5,
%C A253251   d(2) = -5+ceiling(10/-5) = -7,
%C A253251   d(3) = -7+ceiling(10/-7) = -8, which is the negative of a(4) in the original sequence.
%H A253251 Charles R Greathouse IV, <a href="/A253251/b253251.txt">Table of n, a(n) for n = 1..10000</a>
%F A253251 a(n) + 1 <= a(n+1) <= a(n) + 9, hence n <= a(n) <= 9n. - _Charles R Greathouse IV_, Jun 18 2015
%e A253251 a(1) = 1;
%e A253251 a(2) = 1 + floor(10^0/a(1)) = 2 with a(1) = 10^0;
%e A253251 a(3) = 2 + floor(10/a(2)) = 7 with 1 < a(2) < 10;
%e A253251 ...
%e A253251 a(7) = 10 + floor(10/a(6)) = 11 with a(6) = 10;
%e A253251 a(8) = 11 + floor(10^2/a(7)) = 20 with 10 < a(7) < 10^2.
%t A253251 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 *)
%o A253251 (C)
%o A253251 // Input: a(n), Output: a(n+1)
%o A253251 int A253251 (int a) {
%o A253251    int t=1, r=0;
%o A253251    while (t/a==0) {
%o A253251       t*=10;
%o A253251    }
%o A253251    r=t/a;
%o A253251    return r+a;
%o A253251 }
%o A253251 (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
%K A253251 nonn
%O A253251 1,2
%A A253251 _Arlu Genesis A. Padilla_, Jun 05 2015