login
Fractal sequence: count up to successive integers twice.
14

%I #32 Jun 25 2024 01:31:00

%S 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 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 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 Fractal sequence: count up to successive integers twice.

%C 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 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 From _Johannes W. Meijer_, Sep 09 2013: (Start)

%C Triangle read by rows formed from antidiagonals of triangle A002260.

%C The row sums equal A008805(n-1) and the antidiagonal sums equal A211534(n+5). (End)

%H Reinhard Zumkeller, <a href="/A122197/b122197.txt">Table of n, a(n) for n = 1..10000</a>

%F From _Boris Putievskiy_, Sep 09 2013: (Start)

%F a(n) = (A001477(n-1) mod A000194(n-1)) + 1 for n >= 2 with a(1) = 1.

%F a(n) = ((n-1) mod (t+1)) + 1, where t = floor((sqrt(4*n-3)-1)/2). -

%F From _Johannes W. Meijer_, Sep 09 2013: (Start)

%F T(n, k) = k for n >= 1 and 1 <= k <= (n+1)/2; T(n, k) = 0 elsewhere.

%F T(n, k) = A002260(n-k, k). (End)

%F a(n) = n - floor(sqrt(n) + 1/2)*floor(sqrt(n-1)). - _Ridouane Oudra_, Jun 08 2020

%F a(n) = A339399(2n-1). - _Wesley Ivan Hurt_, Jan 09 2022

%e The first few rows of the sequence a(n) as a triangle T(n, k):

%e n/k 1 2 3

%e 1 1

%e 2 1

%e 3 1, 2

%e 4 1, 2

%e 5 1, 2, 3

%e 6 1, 2, 3

%p From _Johannes W. Meijer_, Sep 09 2013: (Start)

%p 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 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 With[{c=Table[Range[n],{n,10}]},Flatten[Riffle[c,c]]] (* _Harvey P. Dale_, Apr 19 2013 *)

%o (Haskell)

%o import Data.List (transpose, genericIndex)

%o a122197 n k = genericIndex (a122197_row n) (k - 1)

%o a122197_row n = genericIndex a122197_tabf (n - 1)

%o a122197_tabf = concat $ transpose [a002260_tabl, a002260_tabl]

%o a122197_list = concat a122197_tabf

%o -- _Reinhard Zumkeller_, Aug 07 2015, Jul 19 2012

%o (PARI) a(n)=n - (sqrtint(4*n) + 1)\2*sqrtint(n-1) \\ _Charles R Greathouse IV_, Jun 08 2020

%Y Cf. A122196, A000290, A033638, A002260, A001477, A000194, A339399.

%K easy,nonn,tabf

%O 1,4

%A _Franklin T. Adams-Watters_, Aug 25 2006