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.

A122197 Fractal sequence: count up to successive integers twice.

This page as a plain text file.
%I A122197 #40 Aug 16 2025 06:19:49
%S A122197 1,1,1,2,1,2,1,2,3,1,2,3,1,2,3,4,1,2,3,4,1,2,3,4,5,1,2,3,4,5,1,2,3,4,
%T A122197 5,6,1,2,3,4,5,6,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,8,1,2,3,4,
%U A122197 5,6,7,8,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,10,1,2,3,4,5
%N A122197 Fractal sequence: count up to successive integers twice.
%C A122197 Fractal - deleting the first occurrence of each integer leaves the original sequence. Also, deleting all the 1's leaves the original sequence plus 1. New values occur at square indices. 1's occur at indices m^2+1 and m^2+m+1. Ordinal transform of A122196.
%C A122197 Except for its initial 1, A122197 is the natural fractal sequence of A002620; that is, A122197(n+1) is the number of the row of A194061 that contains n. See A194029 for definition of natural fractal sequence. - _Clark Kimberling_, Aug 12 2011
%C A122197 From _Johannes W. Meijer_, Sep 09 2013: (Start)
%C A122197 Triangle read by rows formed from antidiagonals of triangle A002260.
%C A122197 The row sums equal A008805(n-1) and the antidiagonal sums equal A211534(n+5). (End)
%H A122197 Reinhard Zumkeller, <a href="/A122197/b122197.txt">Table of n, a(n) for n = 1..10000</a>
%F A122197 From _Boris Putievskiy_, Sep 09 2013: (Start)
%F A122197 a(n) = (A001477(n-1) mod A000194(n-1)) + 1 for n >= 2 with a(1) = 1.
%F A122197 a(n) = ((n-1) mod (t+1)) + 1, where t = floor((sqrt(4*n-3)-1)/2). (End)
%F A122197 From _Johannes W. Meijer_, Sep 09 2013: (Start)
%F A122197 T(n, k) = k for n >= 1 and 1 <= k <= (n+1)/2; T(n, k) = 0 elsewhere.
%F A122197 T(n, k) = A002260(n-k, k). (End)
%F A122197 a(n) = n - floor(sqrt(n) + 1/2)*floor(sqrt(n-1)). - _Ridouane Oudra_, Jun 08 2020
%F A122197 a(n) = A339399(2n-1). - _Wesley Ivan Hurt_, Jan 09 2022
%e A122197 The first few rows of the sequence a(n) as a triangle T(n, k):
%e A122197   n/k  1   2   3
%e A122197   1    1
%e A122197   2    1
%e A122197   3    1,  2
%e A122197   4    1,  2
%e A122197   5    1,  2,  3
%e A122197   6    1,  2,  3
%p A122197 From _Johannes W. Meijer_, Sep 09 2013: (Start)
%p A122197 a := proc(n) local t: t := floor((sqrt(4*n-3)-1)/2): (n-1) mod (t+1) + 1 end: seq(a(n), n=1..105); # End first program
%p A122197 T := proc(n, k): if n < 1 then return(0) elif k < 1 or k> floor((n+1)/2) then return(0) else k fi: end: seq(seq(T(n, k), k=1..floor((n+1)/2)), n=1..19); # End second program. (End)
%t A122197 With[{c=Table[Range[n],{n,10}]},Flatten[Riffle[c,c]]] (* _Harvey P. Dale_, Apr 19 2013 *)
%o A122197 (Haskell)
%o A122197 import Data.List (transpose, genericIndex)
%o A122197 a122197 n k = genericIndex (a122197_row n) (k - 1)
%o A122197 a122197_row n = genericIndex a122197_tabf (n - 1)
%o A122197 a122197_tabf = concat $ transpose [a002260_tabl, a002260_tabl]
%o A122197 a122197_list = concat a122197_tabf
%o A122197 -- _Reinhard Zumkeller_, Aug 07 2015, Jul 19 2012
%o A122197 (PARI) a(n)=n - (sqrtint(4*n) + 1)\2*sqrtint(n-1) \\ _Charles R Greathouse IV_, Jun 08 2020
%o A122197 (Python)
%o A122197 from math import isqrt
%o A122197 def A122197(n): return 1 if n<=1 else 1+((n-1)%((m:=isqrt(n-1))+int(n-1>m*(m+1)))) # _Chai Wah Wu_, Jun 05 2025
%Y A122197 Cf. A122196, A000290, A033638, A002260, A001477, A000194, A339399.
%K A122197 easy,nonn,tabf
%O A122197 1,4
%A A122197 _Franklin T. Adams-Watters_, Aug 25 2006