login
The summarize Fibonacci sequence: summarize the previous two terms!.
18

%I #19 Jun 18 2022 13:24:01

%S 1,1,21,1221,3231,233231,533221,15534221,3514334231,3534533241,

%T 3544832231,183544733221,28172544634231,2827162554535241,

%U 2827265554337241,2837267544338231,3847264544637221,3847362564636221,2837662564536221,2827863534537221,3837564524538221

%N The summarize Fibonacci sequence: summarize the previous two terms!.

%C After the 23rd term the sequence goes into a cycle of 16 terms.

%H Reinhard Zumkeller, <a href="/A036059/b036059.txt">Table of n, a(n) for n = 0..181</a>, 10 periods.

%H <a href="/index/Sa#swys">Index to sequences related to say what you see</a>

%e a(20) = 3837564524538221;

%e a(21) = 4837265534637221;

%e a(22+16*k) = 3837365544636221, k >= 0;

%e a(36) = a(20+16) = 3837265554834221 <> a(20);

%e a(37) = a(21+16) = 3837266544735221 <> a(21);

%e a(38) = a(22+16) = 3837365544636221 = a(22). - _Reinhard Zumkeller_, Aug 10 2014

%p a:= proc(n) option remember; `if`(n<2, 1, (p-> parse(cat(seq((c->

%p `if`(c=0, [][], [c, 9-i][]))(coeff(p, x, 9-i)), i=0..9))))(

%p add(x^i, i=map(x-> convert(x, base, 10)[], [a(n-1),a(n-2)]))))

%p end:

%p seq(a(n), n=0..20); # _Alois P. Heinz_, Jun 18 2022

%t a[0] = a[1] = 1; a[n_] := a[n] = FromDigits @ Flatten @ Reverse @ Select[ Transpose @ { DigitCount[a[n-1]] + DigitCount[a[n-2]], Append[ Range[9], 0]}, #[[1]] > 0&];

%t Table[a[n], {n, 0, 18}] (* _Jean-François Alcover_, Dec 30 2017 *)

%o (Haskell)

%o import Data.List (sort, group)

%o a036059 n = a036059_list !! n

%o a036059_list = map (read . concatMap show) fss :: [Integer] where

%o fss = [1] : [1] : zipWith h (tail fss) fss where

%o h vs ws = concatMap (\us -> [length us, head us]) $

%o group $ reverse $ sort $ vs ++ ws

%o -- _Reinhard Zumkeller_, Aug 10 2014

%o (Python)

%o def aupton(nn):

%o alst = [1, 1]

%o for n in range(2, nn+1):

%o prev2, anstr = sorted(str(alst[-2]) + str(alst[-1])), ""

%o for d in sorted(set(prev2), reverse=True):

%o anstr += str(prev2.count(d)) + d

%o alst.append(int(anstr))

%o return alst

%o print(aupton(20)) # _Michael S. Branicky_, Feb 02 2021

%Y Cf. A036058, A036066.

%K nonn,base,nice,easy

%O 0,3

%A _Floor van Lamoen_