OFFSET

1,1

COMMENTS

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..19770

Eric Weisstein's World of Mathematics, Roman Numerals

Wikipedia, Roman numerals

EXAMPLE

The 3999 Roman numerals of all numbers less than 4000 consist of 30000 digits; there are 19770 runs of consecutive equal digits: a(19770) = 1 is the last term of this sequence;

a(1)=a(52)=7, there are two runs with length 7: the first is "IIIIIII" which is the prefix of the concatenation of I, II, III and IV, the second is "XXXXXXX" which is contained in the concatenation of XXIX, XXX and XXXI;

a(1022)=a(14573)=6, there are also two runs with length 6: the first is "CCCCCC" which is a prefix of the concatenation of CCC and CCCI, the second is "MMMMMM" which is a prefix of the concatenation of MMM and MMMI;

a(30)=5, there is just one run with length 5: "XXXXX" which is contained in the concatenation of XIX, XX and XXI;

a(7)=a(644)=a(1359)=a(9375)=a(19194)=4, there are five runs with length 4: "IIII", two times "CCCC" and "MMMM", they occur in concatenations of (VIII, IX), (CC, CCI), (CCCXC, CCCXCI), (MM, MMI), (MMMCM, MMMCMI), respectively.

MATHEMATICA

A222581full = Map[Length, Split[Flatten[FromRomanNumeral[Characters[RomanNumeral[ Range[3999]]]]]]]; A222581full[[;; 100]] (* Paolo Xausa, Mar 03 2024 *)

PROG

(Haskell)

import Data.List (group)

a222581 n = a222581_list !! (n-1)

a222581_list = map length $ group a093796_list

(Python)

from itertools import groupby

def f(s, k):

return s[:2] if k==4 else (s[1]*(k>=5)+s[0]*(k%5) if k<9 else s[0]+s[2])

def r(n):

m, c, x, i = n//1000, (n%1000)//100, (n%100)//10, n%10

return "M"*m + f("CDM", c) + f("XLC", x) + f("IVX", i)

def afull():

return [len(list(g)) for k, g in groupby("".join(r(i) for i in range(1, 4000)))]

print(afull()[:90]) # Michael S. Branicky, Mar 03 2024

CROSSREFS

KEYWORD

nonn,base,fini,full

AUTHOR

Reinhard Zumkeller, Apr 14 2013

STATUS

approved