2017年6月12日月曜日

170612

Ruby


n の4*k+1 乗

一の位は変わらない。

1.step(50, 4){|i|
  (0..19).each{|j|
    str = (j ** i).to_s
    p [i, str[0..-2] + ' ' + str[-1]]
  }
  p ''
}

出力結果
[1, " 0"]
[1, " 1"]
[1, " 2"]
[1, " 3"]
[1, " 4"]
[1, " 5"]
[1, " 6"]
[1, " 7"]
[1, " 8"]
[1, " 9"]
[1, "1 0"]
[1, "1 1"]
[1, "1 2"]
[1, "1 3"]
[1, "1 4"]
[1, "1 5"]
[1, "1 6"]
[1, "1 7"]
[1, "1 8"]
[1, "1 9"]
""
[5, " 0"]
[5, " 1"]
[5, "3 2"]
[5, "24 3"]
[5, "102 4"]
[5, "312 5"]
[5, "777 6"]
[5, "1680 7"]
[5, "3276 8"]
[5, "5904 9"]
[5, "10000 0"]
[5, "16105 1"]
[5, "24883 2"]
[5, "37129 3"]
[5, "53782 4"]
[5, "75937 5"]
[5, "104857 6"]
[5, "141985 7"]
[5, "188956 8"]
[5, "247609 9"]
""
[9, " 0"]
[9, " 1"]
[9, "51 2"]
[9, "1968 3"]
[9, "26214 4"]
[9, "195312 5"]
[9, "1007769 6"]
[9, "4035360 7"]
[9, "13421772 8"]
[9, "38742048 9"]
[9, "100000000 0"]
[9, "235794769 1"]
[9, "515978035 2"]
[9, "1060449937 3"]
[9, "2066104678 4"]
[9, "3844335937 5"]
[9, "6871947673 6"]
[9, "11858787649 7"]
[9, "19835929036 8"]
[9, "32268769777 9"]
""
[13, " 0"]
[13, " 1"]
[13, "819 2"]
[13, "159432 3"]
[13, "6710886 4"]
[13, "122070312 5"]
[13, "1306069401 6"]
[13, "9688901040 7"]
[13, "54975581388 8"]
[13, "254186582832 9"]
[13, "1000000000000 0"]
[13, "3452271214393 1"]
[13, "10699320537907 2"]
[13, "30287510659225 3"]
[13, "79371477325414 4"]
[13, "194619506835937 5"]
[13, "450359962737049 6"]
[13, "990457803290593 7"]
[13, "2082296486567116 8"]
[13, "4205298346225705 9"]
""
[17, " 0"]
[17, " 1"]
[17, "13107 2"]
[17, "12914016 3"]
[17, "1717986918 4"]
[17, "76293945312 5"]
[17, "1692665944473 6"]
[17, "23263051398720 7"]
[17, "225179981368524 8"]
[17, "1667718169966656 9"]
[17, "10000000000000000 0"]
[17, "50544702849929377 1"]
[17, "221861110674043699 2"]
[17, "865041591938133793 3"]
[17, "3049134672933119590 4"]
[17, "9852612533569335937 5"]
[17, "29514790517935282585 6"]
[17, "82724026188633676417 7"]
[17, "218591155973869653196 8"]
[17, "548038685778480218593 9"]
""
[21, " 0"]
[21, " 1"]
[21, "209715 2"]
[21, "1046035320 3"]
[21, "439804651110 4"]
[21, "47683715820312 5"]
[21, "2193695064037785 6"]
[21, "55854586408328400 7"]
[21, "922337203685477580 8"]
[21, "10941898913151235920 9"]
[21, "100000000000000000000 0"]
[21, "740024994425816010121 1"]
[21, "4600511990936970146611 2"]
[21, "24706452907345039270441 3"]
[21, "117135557595398722184806 4"]
[21, "498788509511947631835937 5"]
[21, "1934281311383406679529881 6"]
[21, "6909193391300873288082721 7"]
[21, "22946825189512940713987276 8"]
[21, "71420949569337320567375641 9"]
""
[25, " 0"]
[25, " 1"]
[25, "3355443 2"]
[25, "84728860944 3"]
[25, "112589990684262 4"]
[25, "29802322387695312 5"]
[25, "2843028802992970137 6"]
[25, "134106861966396490080 7"]
[25, "3777893186295716170956 8"]
[25, "71789798769185258877024 9"]
[25, "1000000000000000000000000 0"]
[25, "10834705943388372204183025 1"]
[25, "95396216644069012960129843 2"]
[25, "705641001486681666603073969 3"]
[25, "4499879580584837311451522662 4"]
[25, "25251168294042348861694335937 5"]
[25, "126765060022822940149670320537 6"]
[25, "577062741234840237893956999105 7"]
[25, "2408865921094310464391528369356 8"]
[25, "9307649568825608953660961028049 9"]
""
[29, " 0"]
[29, " 1"]
[29, "53687091 2"]
[29, "6863037736488 3"]
[29, "28823037615171174 4"]
[29, "18626451492309570312 5"]
[29, "3684565328678889298329 6"]
[29, "321990575581317972683760 7"]
[29, "15474250491067253436239052 8"]
[29, "471012869724624483492160368 9"]
[29, "10000000000000000000000000000 0"]
[29, "158630929717149157441443670489 1"]
[29, "1978135948331415052741252428595 2"]
[29, "20153812643461115079850395637177 3"]
[29, "172867373967747110156721694598758 4"]
[29, "1278340394885893911123275756835937 5"]
[29, "8307674973655724205648794126752153 6"]
[29, "48196857210675091509141182522307169 7"]
[29, "252873108932796335309965082101599436 8"]
[29, "1212982199458922184450050102136491017 9"]
""
[33, " 0"]
[33, " 1"]
[33, "858993459 2"]
[33, "555906056655552 3"]
[33, "7378697629483820646 4"]
[33, "11641532182693481445312 5"]
[33, "4775196665967840530635161 6"]
[33, "773099371970744452413709440 7"]
[33, "63382530011411470074835160268 8"]
[33, "3090315438263261236192064180352 9"]
[33, "100000000000000000000000000000000 0"]
[33, "2322515441988780814100176779630913 1"]
[33, "41018627024600222533642610359350067 2"]
[33, "575613042909892907795607149793420865 3"]
[33, "6640873038344972983780620619705902694 4"]
[33, "64715982491098379250615835189819335937 5"]
[33, "544451787073501541541399371890829138329 6"]
[33, "4025449711092794317934980705445617120513 7"]
[33, "26545607483329228095498894458697502477516 8"]
[33, "158077053215686197999714979360529645943745 9"]
""
[37, " 0"]
[37, " 1"]
[37, "13743895347 2"]
[37, "45028390589099736 3"]
[37, "1888946593147858085478 4"]
[37, "7275957614183425903320312 5"]
[37, "6188654879094321327703169433 6"]
[37, "1856211592101757430245316367120 7"]
[37, "259614842926741381426524816461004 8"]
[37, "20275559590445256970656133087295376 9"]
[37, "1000000000000000000000000000000000000 0"]
[37, "34003948586157739899240688230576198697 1"]
[37, "850562249982110214457613168411482993459 2"]
[37, "16440084118549451339550335805249893333833 3"]
[37, "255115778641060482144916321726621957908070 4"]
[37, "3276246613611855449562426656484603881835937 5"]
[37, "35681192317648997026457149236237378409568665 6"]
[37, "336209585320181274228247523499523387522424737 7"]
[37, "2786651691169969048553091944696229020079803596 8"]
[37, "20600759652121441009520855825243583989034909433 9"]
""
[41, " 0"]
[41, " 1"]
[41, "219902325555 2"]
[41, "3647299637717078640 3"]
[41, "483570327845851669882470 4"]
[41, "4547473508864641189575195312 5"]
[41, "8020496723306240440703307585945 6"]
[41, "4456764032636319590019004597456800 7"]
[41, "1063382396627932698323045648224275660 8"]
[41, "133027946472911330984474889185744967840 9"]
[41, "10000000000000000000000000000000000000000 0"]
[41, "497851811249935469864782916383866125124241 1"]
[41, "17637258815629037406993066660180511352369971 2"]
[41, "469545242509890879708897140933742203507612881 3"]
[41, "9800527752274979482079105415449909134996432486 4"]
[41, "165859984814100182134097849484533071517944335937 5"]
[41, "2338402619729444669125895732346052831449492068761 6"]
[41, "28080560775526860204817461410203692849260436517441 7"]
[41, "292531547932258670840909379986431337611897462377676 8"]
[41, "2684711598624118313801767452001569109035018432335281 9"]
""
[45, " 0"]
[45, " 1"]
[45, "3518437208883 2"]
[45, "295431270655083369864 3"]
[45, "123794003928538027489912422 4"]
[45, "2842170943040400743484497070312 5"]
[45, "10394563753404887611151486631385497 6"]
[45, "10700690442359803335635630038493778480 7"]
[45, "4355614296588012332331194975126633106636 8"]
[45, "872796356808771242589139747947672734004144 9"]
[45, "100000000000000000000000000000000000000000000 0"]
[45, "7289048368510305214290286678776183937944013945 1"]
[45, "365726198800883719671408230265503083402743722803 2"]
[45, "13410681671324993415365811242208611074380931502809 3"]
[45, "376497074131395611783550913639923709330022950397542 4"]
[45, "8396661731213821720538703630154486745595932006835937 5"]
[45, "153249554086588885835834702715030918361873912218360217 6"]
[45, "2345316516532778891166559194441622630463080918373248225 7"]
[45, "30708791775736786230195303073455616097146548010558999756 8"]
[45, "349874300244293722772960136112296487858552637120366272489 9"]
""
[49, " 0"]
[49, " 1"]
[49, "56294995342131 2"]
[49, "23929932923061752959008 3"]
[49, "31691265005705735037417580134 4"]
[49, "1776356839400250464677810668945312 5"]
[49, "13471354624412734344052326674275604889 6"]
[49, "25692357752105887808861147722423562132160 7"]
[49, "17840596158824498513228574618118689204784332 8"]
[49, "5726416897022348122627345886284680807801194688 9"]
[49, "1000000000000000000000000000000000000000000000000 0"]
[49, "106718957163359378642424087263962109035438308170209 1"]
[49, "7583698458335124811106321062785471937439293836047155 2"]
[49, "383022479214713136936262934888720140895393784651736417 3"]
[49, "14463511599831693822276891898391309217622161662471988838 4"]
[49, "425081000142699724602271871276570891495794057846069335937 5"]
[49, "10043362776618689222137263077132266265763768711142455220633 6"]
[49, "195883180777334225769122190478958763718906981383452065058689 7"]
[49, "3223686125449744871300982135439076755414056023956441558469836 8"]
[49, "45595968682136602245494937898290590594214438222163252997156257 9"]
""

0 件のコメント:

コメントを投稿