login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A093796
Sequence of digit-values after concatenating the natural numbers < 4000 in Roman numeral representation.
2
1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 5, 1, 1, 5, 1, 1, 1, 1, 10, 10, 10, 1, 10, 1, 1, 10, 1, 1, 1, 10, 1, 5, 10, 5, 10, 5, 1, 10, 5, 1, 1, 10, 5, 1, 1, 1, 10, 1, 10, 10, 10, 10, 10, 1, 10, 10, 1, 1, 10, 10, 1, 1, 1, 10, 10, 1, 5, 10, 10, 5, 10, 10, 5, 1, 10, 10, 5, 1
OFFSET
1,8
COMMENTS
In other words, read the sequence of Roman numerals of natural numbers without spaces: I II III IV V VI VII VIII IX, ..., replacing I by 1, V by 5, X by 10, etc.
REFERENCES
GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See Question 300(b), page 199.
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..30000 (complete up to 3999)
Eric Weisstein's World of Mathematics, Roman Numerals
EXAMPLE
I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII, ...
I,(I,I),(I,I,I),(I,V),V,(V,I),(V,I,I),(V,I,I,I),(I,X), ...
1,(1,1),(1,1,1),(1,5),5,(5,1),(5,1,1),(5,1,1,1),(1,10), ...
1,1,1,1,1,1,1,5,5,5,1,5,1,1,5,1,1,1,1,10,10,10,1,10,1,1, ...
MAPLE
for n from 1 to 50 do r:=convert(n, roman): for j from 1 to length(r) do printf("%d, ", convert(r[j], arabic)): od: od: # Nathaniel Johnston, May 18 2011
MATHEMATICA
A093796full = Flatten[FromRomanNumeral[Characters[RomanNumeral[Range[3999]]]]];
A093796full[[;; 100]] (* Paolo Xausa, Mar 03 2024 *)
PROG
(Haskell)
import Data.List (unfoldr)
a093796 n = a093796_list !! n
a093796_list = concatMap (reverse . unfoldr r) $ map a061493 [1..3999]
where r 0 = Nothing
r x = Just ([0, 1, 5, 10, 50, 100, 500, 1000] !! fromInteger d, x')
where (x', d) = divMod x 10
-- Reinhard Zumkeller, Apr 14 2013
(Python)
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():
v = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000}
ans = []
for i in range(1, 4000): ans.extend([v[d] for d in r(i)])
return ans
print(afull()[:80]) # Michael S. Branicky, Mar 04 2024
CROSSREFS
Cf. A007376.
Cf. A061493; A222581 (run lengths).
Sequence in context: A230192 A172359 A379377 * A021647 A181668 A247824
KEYWORD
nonn,base,easy,fini,full
AUTHOR
Reinhard Zumkeller, May 18 2004
STATUS
approved