台形数
でふれられていた
$ \frac{(a+b)\times b}{2} = 10^6 \times a + b
を満す6桁の整数の組 $ (a,b)
これを6桁の台形数と呼ぶことにしよう(勝手にオレオレ定義)
code:Trapezoid.hs
module Trapezoid where
, let (a,r) = divMod (b*(b-2)) (2*10^d-b)
, r == 0
, a < 10^d
, a >= 10^(d-1)
]
main :: IO ()
main = putStr $ unlines $ map (show . phi) 1 .. 11 -- 1 〜 11桁の台形数列挙 where
phi d = (d, len, cs)
where
len = length cs
cs = trapezoid d
code:stdout
# 1桁の台形数2組
# 2桁の台形数5組
(2,5,(16,50),(21,56),(34,68),(52,80),(72,90)) # 3桁の台形数10組
(3,10,(166,500),(182,520),(217,560),(312,650),(334,668),(532,800),(561,816),(679,875),(712,890),(782,920)) # 4桁の台形数17組
(4,17,(1092,4160),(1552,4850),(1666,5000),(2046,5456),(2177,5600),(2840,6250),(3334,6668),(3502,6800),(4307,7375),(4697,7625),(5122,7880),(5332,8000),(6804,8750),(7112,8890),(7362,9000),(8437,9440),(9702,9900)) # 5桁の台形数20組
(5,20,(12348,43904),(13912,46250),(16666,50000),(18602,52400),(21777,56000),(30702,64500),(33334,66668),(36077,68800),(37582,69920),(40319,71875),(48202,77000),(49952,78050),(53332,80000),(56832,81920),(68054,87500),(71112,88890),(77402,91600),(88441,95936),(92742,97500),(95227,98375)) # 6桁の台形数149組
(6,149,(100902,401600),(107302,412700),(109252,416000),(114682,425000),(116232,427520),(122257,437120),(124102,440000),(128002,446000),(132733,453125),(134402,455600),(137402,460000),(137952,460800),(138462,461540),(140427,464375),(147052,473750),(148810,476192),(155152,484850),(157502,488000),(164247,496875),(165502,498500),(166666,500000),(173092,508160),(178602,515000),(181482,518520),(182702,520000),(184027,521600),(195202,534800),(197542,537500),(202477,543125),(203252,544000),(204546,545456),(214312,556250),(215002,557000),(216442,558560),(217777,560000),(227202,570000),(228572,571430),(232502,575500),(235061,578125),(250344,593408),(253002,596000),(257142,600000),(258602,601400),(270382,612500),(272002,614000),(272782,614720),(284090,625000),(285627,626375),(286552,627200),(292522,632480),(295402,635000),(307623,645504),(311352,648650),(312962,650000),(316802,653200),(324307,659375),(333334,666668),(335002,668000),(336812,669440),(346752,677250),(350302,680000),(360118,687500),(362902,689600),(373652,697600),(376922,700000),(377777,700625),(378702,701300),(383802,705000),(386680,707072),(395002,713000),(402052,717950),(403157,718720),(406847,721280),(416837,728125),(419842,730160),(430627,737375),(434602,740000),(448052,748750),(451952,751250),(453127,752000),(460702,756800),(469822,762500),(473022,764480),(478752,768000),(480770,769232),(484502,771500),(497002,779000),(500800,781250),(512122,787880),(516477,790400),(527799,796875),(528902,797500),(531202,798800),(533332,800000),(550477,809525),(555002,812000),(560186,814816),(562377,816000),(567492,818750),(584662,827840),(588802,830000),(597502,834500),(615708,843750),(618202,845000),(619402,845600),(621904,846848),(640502,856000),(642858,857144),(649602,860400),(653982,862500),(678127,873875),(680554,875000),(684452,876800),(691427,880000),(693882,881120),(711112,888890),(713602,890000),(716302,891200),(717601,891776),(736362,900000),(738902,901100),(743597,903125),(750268,905984),(755002,908000),(778252,917750),(781082,918920),(783702,920000),(789942,922560),(802102,927500),(812377,931625),(819352,934400),(838202,941800),(843877,944000),(859522,950000),(863947,951680),(884467,959375),(886152,960000),(887502,960500),(888962,961040),(897002,964000),(910036,968750),(914602,970400),(925642,974360),(930952,976250),(948702,982500),(953374,984128),(970102,989900),(976252,992000),(997002,999000)) # 7桁の台形数24組
(7,24,(1446627,4704000),(1666666,5000000),(1715742,5062500),(1764302,5123200),(2060927,5471875),(2177777,5600000),(2234002,5660000),(2627002,6053000),(2822652,6233600),(3197352,6556250),(3264122,6610880),(3333334,6666668),(5333332,8000000),(5422802,8050000),(5510817,8098560),(6038502,8377500),(6339502,8528000),(6805554,8750000),(6907447,8796875),(7007602,8842400),(7111112,8888890),(7947002,9245000),(8055048,9288704),(8700252,9539750)) # 8桁の台形数132組
(8,132,(10009002,40016000),(10339742,40597760),(10915842,41584160),(10925252,41600000),(11270877,42176000),(11277846,42187500),(12240027,43734375),(12259977,43765625),(12500595,44140032),(12592762,44282240),(12626252,44333750),(13273358,45312500),(13619752,45824000),(13654602,45875000),(14005987,46384640),(15007002,47793000),(15108127,47931875),(15515152,48484850),(15526402,48500000),(16128002,49300000),(16232902,49437500),(16655002,49985000),(16666666,50000000),(18720002,52540000),(19868722,53881280),(19972602,54000000),(19985402,54014600),(20454546,54545456),(20467502,54560000),(21159502,55328000),(21280002,55460000),(21764402,55985600),(21777777,56000000),(23486127,57792000),(23659412,57968750),(24124102,58438400),(24404452,58718750),(24876582,59185920),(25548127,59840000),(26903802,61125000),(27450002,61630000),(27587752,61756250),(28393752,62486250),(28409090,62500000),(28970802,63000000),(28986302,63013700),(29112442,63125000),(30550002,64370000),(33333334,66666668),(33350002,66680000),(33960202,67164800),(34114002,67286000),(35013202,67986800),(35030302,68000000),(35656252,68480000),(35814002,68600000),(38014802,70235200),(38073877,70278125),(38667930,70707072),(39812502,71520000),(39873022,71562500),(40481552,71987200),(40518452,72012800),(41193669,72478208),(42357674,73267328),(43062627,73737375),(43081682,73750000),(44273232,74531250),(44980502,74987500),(45019502,75012500),(45667960,75425792),(45733002,75467000),(46962377,76237625),(46982322,76250000),(47712002,76700000),(50265602,78234400),(50454502,78345500),(51212122,78787880),(51233002,78800000),(52345002,79440000),(52538002,79550000),(53312002,79988000),(53333332,80000000),(56313169,81640625),(57043002,82032000),(57482217,82265625),(59082478,83105024),(59265752,83200000),(59288322,83211680),(60136377,83648000),(61346977,84262400),(61557002,84368000),(62399022,84788480),(62415927,84796875),(64555252,85844750),(64747430,85937500),(65660202,86375000),(66452407,86750720),(66929002,86975000),(67149077,87078125),(67729391,87348736),(68031252,87488750),(68055554,87500000),(71111112,88888890),(71136002,88900000),(72046002,89304000),(72275002,89405000),(73611002,89989000),(73636362,90000000),(74563502,90400000),(74589042,90410960),(74796802,90500000),(77154002,91496000),(80753876,92968750),(81693502,93344000),(82674412,93731840),(82921202,93828800),(84360562,94389440),(84387877,94400000),(85637502,94880000),(88194652,95843750),(89124342,96188160),(89217502,96222500),(91003786,96875000),(91949627,97216000),(92044402,97250000),(92306172,97343750),(95938752,98621250),(97010102,98989900),(97039602,99000000),(98880602,99625000),(99970002,99990000)) # 9桁の台形数47数
(9,47,(100902502,401600000),(111496914,419753088),(123500062,439062500),(135209877,456790125),(139100038,462462464),(165501502,498498500),(166666666,500000000),(167836002,501500000),(181481482,518518520),(182702702,520000000),(216441442,558558560),(217777777,560000000),(270382882,612500000),(311351352,648648650),(312962962,650000000),(331668002,665332000),(333333334,666666668),(335003002,668000000),(375856324,699218750),(382419752,704000000),(403156282,718718720),(406848127,721280000),(426118826,734375000),(448051252,748748750),(451953202,751250000),(474567902,765432100),(531201202,798798800),(533333332,800000000),(535470002,801200000),(560185186,814814816),(562378377,816000000),(587453207,829296875),(615709458,843750000),(621903154,846846848),(678126127,873873875),(680555554,875000000),(711111112,888888890),(713603602,890000000),(781081082,918918920),(783703702,920000000),(813984402,932265600),(819353752,934400000),(878869377,957290625),(884468842,959375000),(927368776,974974976),(963117282,987500000),(997001002,998999000)) # 10桁の台形数151桁
(10,151,(1000090002,4000160000),(1069558156,4121093750),(1083357392,4144531250),(1092525252,4160000000),(1136180402,4232569600),(1150407442,4255842560),(1212725502,4355712000),(1224900252,4374843750),(1225099752,4375156250),(1234756098,4390243904),(1234856252,4390400000),(1327335858,4531250000),(1375481252,4602118750),(1391153752,4624846250),(1391260162,4625000000),(1401559852,4639846400),(1459705002,4722375000),(1484012402,4756250000),(1551515152,4848484850),(1562514436,4863266816),(1666550002,4999850000),(1666666666,5000000000),(1738240002,5090760000),(1741632002,5095000000),(1841966002,5218034000),(1860147602,5239852400),(1860271002,5240000000),(1939520002,5333480000),(2045325002,5454400000),(2045454546,5454545456),(2148186252,5568000000),(2164740006,5585937500),(2177644002,5599856000),(2177777777,5600000000),(2259745402,5687129600),(2263625002,5691200000),(2347361252,5777920000),(2364405902,5795312500),(2378187362,5809312640),(2475124722,5906250000),(2489234202,5920140800),(2506800627,5937359375),(2595012502,6022587500),(2599178302,6026562500),(2609322877,6036224000),(2689038002,6111250000),(2703463754,6124661248),(2722093127,6141906875),(2840909090,6250000000),(2841062502,6250137500),(2851683711,6259644416),(2856057377,6263552000),(2969540002,6363500000),(3070135502,6449864500),(3070295202,6450000000),(3093932002,6470000000),(3228316002,6581684000),(3232980002,6585500000),(3333333334,6666666668),(3333500002,6666800000),(3486356995,6787109375),(3503030302,6800000000),(3607631202,6879868800),(3607804877,6880000000),(3646290002,6908960000),(3741010327,6979296875),(3758130082,6991869920),(3758307502,6992000000),(3784562502,7011200000),(3866792930,7070707072),(4031828127,7187371875),(4032012194,7187500000),(4049815502,7199872000),(4050184502,7200128000),(4072794752,7215781250),(4191439882,7296875000),(4219235802,7315625000),(4306262627,7373737375),(4324881822,7386055680),(4353138454,7404674048),(4475977277,7484569600),(4499805002,7499875000),(4500195002,7500125000),(4698232322,7625000000),(4790305002,7681695000),(4820123002,7699877000),(4820325202,7700000000),(4949700002,7777900000),(4995121952,7804878050),(4995328002,7805000000),(5121212122,7878787880),(5333120002,7999880000),(5333333332,8000000000),(5463642002,8072608000),(5469790002,8076000000),(5650572802,8174427200),(5683118082,8191881920),(5683338752,8192000000),(5824466002,8266784000),(5988963752,8352156250),(5995420212,8355468750),(6011136252,8363520000),(6219596882,8468750000),(6241990202,8479884800),(6367658752,8541781250),(6383890072,8549703680),(6390571252,8552960000),(6563398002,8636250000),(6586924890,8647450112),(6751718402,8725000000),(6775606112,8736112640),(6805312502,8749887500),(6805555554,8750000000),(6953930002,8818070000),(6960926002,8821250000),(7111111112,8888888890),(7111360002,8889000000),(7166474502,8913525500),(7363636362,9000000000),(7363890002,9000110000),(7575500002,9090800000),(7740108402,9159891600),(7740369002,9160000000),(7778915002,9176000000),(7997152802,9265347200),(8004700002,9268400000),(8166935002,9333440000),(8199806827,9346484375),(8371915358,9414062500),(8412145462,9429687500),(8438787877,9440000000),(8605479962,9503895040),(8639859377,9516940625),(8647732527,9519921875),(8666894502,9527168000),(8816946502,9583437500),(8844004066,9593495936),(8844284377,9593600000),(8885743127,9608960000),(9100378786,9687500000),(9274102502,9749897500),(9274390242,9750000000),(9302211777,9759897600),(9302788227,9760102400),(9338095002,9772625000),(9522601627,9837398375),(9522893602,9837500000),(9566076002,9852500000),(9701010102,9898989900),(9729827333,9908844544),(9999700002,9999900000)) # 11桁の台形数30組
(11,30,(11366239552,42332979200),(12492300002,44127200000),(13759700002,46028300000),(14997899252,47780468750),(16666666666,50000000000),(18425332002,52187168000),(21455668752,55651531250),(21777777777,56000000000),(27250537502,61446400000),(30931914002,64693750000),(33333333334,66666666668),(35828246502,68610816000),(37837400002,70106000000),(40055350002,71690250000),(42183650977,73150390625),(45472615002,75301760000),(47912360002,76822640000),(50248585002,78224375000),(52819030627,79709609375),(53333333332,80000000000),(56515890602,81749734400),(61862775002,84521225000),(68055555554,87500000000),(71111111112,88888888890),(71714051877,89157120000),(77777080002,91755000000),(85660175327,94888652800),(88844450002,96084800000),(92329800002,97352200000),(95647239502,98520312500))