[seqfan] How to define analogue to this sequence pertaining to Roman numerals

Alonso Del Arte alonso.delarte at gmail.com
Thu Apr 8 23:12:24 CEST 2021


Almost all integers from 1 to 3999 are Roman numeral Harshad numbers. Much
fewer of them can have their Roman numeral representations built up from
the Roman numeral representations of their nontrivial divisors. For
example, the divisors of 80 include 20 and 40, which in Roman numerals are
XX and XL, respectively. From those we can assemble LXXX. I'm not
interested in requiring that all the "digits" of a divisor be used, e.g.,
for LXXX we could use X, XX and XL, using XL only for the L and discarding
the extra X.

scala> (1 to 3999).filter(romNumDivAnagrammable)
res12: IndexedSeq[Int] = Vector(8, 18, 36, 80, 84, 88, 180, 184, 186, 270,
276, 282, 288, 360, 372, 380, 384, 396, 800, 804, 808, 810, 812, 816, 820,
822, 828, 832, 834, 836, 840, 846, 848, 852, 858, 860, 864, 868, 870, 876,
880, 882, 884, 888, 894, 896, 1800, 1804, 1806, 1808, 1812, 1816, 1818,
1820, 1824, 1830, 1832, 1836, 1840, 1848, 1856, 1860, 1864, 1872, 1876,
1880, 1884, 1888, 1890, 1896, 2700, 2706, 2712, 2718, 2724, 2730, 2736,
2742, 2748, 2754, 2760, 2766, 2772, 2778, 2784, 2790, 2796, 2802, 2808,
2814, 2820, 2826, 2832, 2838, 2844, 2850, 2856, 2862, 2868, 2874, 2880,
2886, 2892, 2898, 3600, 3612, 3624, 3636, 3648, 3660, 3672, 3684, 3696,
3708, 3720, 3732, 3744, 3756, 3768, 3780, 3792, 3800, 3804, 3808, 3810,
3816, 3820, 3822, 3824, 3828, 3832, 3834, 3836, 3840, 3846, 3848, 38...

scala> romNums(res21)
res23: IndexedSeq[numerics.RomanNumeralsNumber] = Vector(MMMDCCCXXIV,
MMMDCCCXXVIII, MMMDCCCXXXII, MMMDCCCXXXIV, MMMDCCCXXXVI, MMMDCCCXL,
MMMDCCCXLVI, MMMDCCCXLVIII, MMMDCCCLII, MMMDCCCLVI, MMMDCCCLVIII,
MMMDCCCLX, MMMDCCCLXIV, MMMDCCCLXX, MMMDCCCLXXII, MMMDCCCLXXVI,
MMMDCCCLXXX, MMMDCCCLXXXII, MMMDCCCLXXXVIII, MMMDCCCXCII, MMMDCCCXCIV,
MMMCM, MMMCMXII, MMMCMXXIV, MMMCMXXXVI, MMMCMXLVIII, MMMCMLX, MMMCMLXXII,
MMMCMLXXXIV, MMMCMXCVI)

scala> romNums(res18)
res24: IndexedSeq[numerics.RomanNumeralsNumber] = Vector(VIII, XVIII,
XXXVI, LXXX, LXXXIV, LXXXVIII, CLXXX, CLXXXIV, CLXXXVI, CCLXX, CCLXXVI,
CCLXXXII, CCLXXXVIII, CCCLX, CCCLXXII, CCCLXXX, CCCLXXXIV, CCCXCVI, DCCC,
DCCCIV, DCCCVIII, DCCCX, DCCCXII, DCCCXVI, DCCCXX, DCCCXXII, DCCCXXVIII,
DCCCXXXII, DCCCXXXIV, DCCCXXXVI, DCCCXL, DCCCXLVI, DCCCXLVIII, DCCCLII,
DCCCLVIII, DCCCLX, DCCCLXIV, DCCCLXVIII, DCCCLXX, DCCCLXXVI, DCCCLXXX,
DCCCLXXXII, DCCCLXXXIV, DCCCLXXXVIII, DCCCXCIV, DCCCXCVI, MDCCC, MDCCCIV,
MDCCCVI, MDCCCVIII, MDCCCXII, MDCCCXVI, MDCCCXVIII, MDCCCXX, MDCCCXXIV,
MDCCCXXX, MDCCCXXXII, MDCCCXXXVI, MDCCCXL, MDCCCXLVIII, MDCCCLVI, MDCCCLX,
MDCCCLXIV, MDCCCLXXII, MDCCCLXXVI, MDCCCLXXX, MDCCCLXXXIV, MDCCCLXXXVIII,
MDCCCXC, MDCCCXCVI, MMDCC, MMDCCVI, MMDCCXII, MMDCCXVIII, MMDCCXXIV, M...

I wrote the Boolean romNumDivAnagrammable() function to only consider the
divisors of *n* other than 1 and *n* itself. If I haven't made a mistake
somewhere, I can assert that this doesn't make a difference for "divisor
anagrammables" in Roman numerals. Taking this to decimal, we see that 12
would not thus be "divisor anagrammable," since the divisor 1 is not
considered. Thoughts?

Al

-- 
Alonso del Arte
Author at SmashWords.com
<https://www.smashwords.com/profile/view/AlonsoDelarte>
Musician at ReverbNation.com <http://www.reverbnation.com/alonsodelarte>



More information about the SeqFan mailing list