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)
Stephanus Gibbs, Roman Numeral and Date Conversion
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
KEYWORD
nonn,base,easy,fini,full
AUTHOR
Reinhard Zumkeller, May 18 2004
STATUS
approved