arithmomania

noun
arith·​mo·​ma·​nia | \ ə-ˌrith-mō-ˈmā-nē-ə, -nyə How to pronounce arithmomania (audio) \

Medical Definition of arithmomania

: an abnormal compulsion to count objects or actions and make mathematical calculations … one finds that this arithmomania is, as it were, the surface of a more fundamental compulsion, which has to do with order and disorder: the need to order, disorder, reorder; the contemplation of order, disorder, new order. Arithmomania has to do with arithmetical order …— Oliver Sacks, Awakenings, 1990