2020年11月28日土曜日

201128

Python


Number of closed Knight's tours on a m X n board.

m = 3, 4, 5, 6 のときを出力してみた。

from graphillion import GraphSet

# (n > 3 and k > 2) or (n > 2 and k > 3)
def make_nXk_knight_graph(n, k):
    grids = []
    for i in range(1, k + 1):
        for j in range(1, n - 1):
            if i < k:
                grids.append((i + (j - 1) * k, i + (j + 1) * k + 1))
            if  i > 1:
                grids.append((i + (j - 1) * k, i + (j + 1) * k - 1))
    for i in range(1, k * n, k):
        for j in range(1, k - 1):
            if i < k * (n - 1):
                grids.append((i + j - 1, i + j + 1 + k))
            if i > k:
                grids.append((i + j - 1, i + j + 1 - k))
    return grids

def A(n, k):
    if n == 3 and k == 3: return 0
    universe = make_nXk_knight_graph(n, k)
    GraphSet.set_universe(universe)
    cycles = GraphSet.cycles(is_hamilton=True)
    return cycles.len()

print([A(3, n) for n in range(3, 30)])
print([A(4, n) for n in range(3, 20)])
print([A(5, n) for n in range(3, 10)])
print([A(6, n) for n in range(3, 8)])

出力結果
[0, 0, 0, 0, 0, 0, 0, 16, 0, 176, 0, 1536, 0, 15424, 0, 147728, 0, 1448416, 0, 14060048, 0, 136947616, 0, 1332257856, 0, 12965578752, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 8, 0, 44202, 0]
[0, 0, 8, 9862, 1067638]

2020年11月17日火曜日

201117

Sage


公開鍵作成(ビットコイン)(3)

Sage を最近入れなおしたら、
print 文が使えなく、print 関数でないと動かなくなっていた。

sage: p=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F
sage: p
115792089237316195423570985008687907853269984665640564039457584007908834671663
sage: E=EllipticCurve(GF(p), [0, 7])
sage: Gx=0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798
sage: Gy=0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
sage: G=E([Gx, Gy])
sage: N=0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141
sage: N
115792089237316195423570985008687907852837564279074904382605163141518161494337
sage: N*G
(0 : 1 : 0)
sage: 2017101920171019*G
(36572950727085182085382801403406684418997739286809164939833038507156062366242 : 43641162618061335383666517243600726585787626462467298998793806674351551668099 : 1)
sage: for i in [1..50]:
....:     print([i, i*G])
....:
[1, (55066263022277343669578718895168534326250603453777594175500187360389116729240 : 32670510020758816978083085130507043184471273380659243275938904335757337482424 : 1)]
[2, (89565891926547004231252920425935692360644145829622209833684329913297188986597 : 12158399299693830322967808612713398636155367887041628176798871954788371653930 : 1)]
[3, (112711660439710606056748659173929673102114977341539408544630613555209775888121 : 25583027980570883691656905877401976406448868254816295069919888960541586679410 : 1)]
[4, (103388573995635080359749164254216598308788835304023601477803095234286494993683 : 37057141145242123013015316630864329550140216928701153669873286428255828810018 : 1)]
[5, (21505829891763648114329055987619236494102133314575206970830385799158076338148 : 98003708678762621233683240503080860129026887322874138805529884920309963580118 : 1)]
[6, (115780575977492633039504758427830329241728645270042306223540962614150928364886 : 78735063515800386211891312544505775871260717697865196436804966483607426560663 : 1)]
[7, (41948375291644419605210209193538855353224492619856392092318293986323063962044 : 48361766907851246668144012348516735800090617714386977531302791340517493990618 : 1)]
[8, (21262057306151627953595685090280431278183829487175876377991189246716355947009 : 41749993296225487051377864631615517161996906063147759678534462689479575333124 : 1)]
[9, (78173298682877769088723994436027545680738210601369041078747105985693655485630 : 92362876758821804597230797234617159328445543067760556585160674174871431781431 : 1)]
[10, (72488970228380509287422715226575535698893157273063074627791787432852706183111 : 62070622898698443831883535403436258712770888294397026493185421712108624767191 : 1)]
[11, (53957576663012291606402345341061437133522758407718089353314528343643821967563 : 98386217607324929854432842186271083758341411730506808463586570492533445740059 : 1)]
[12, (94111259592240215275188773285036844871058226277992966241101117022315524122714 : 76870767327212528811304566602812752860184934880685532702451763239157141742375 : 1)]
[13, (109699032664856045668214896063362497021339186688470416858630178803463338613416 : 4835088675770141268294878046681321747490758260515711581034896622314066275713 : 1)]
[14, (33301309993451753050311554695703528430361259803437469669590207169100761277412 : 91711666877231500617203373035680263572492971120307578300405368749466283229019 : 1)]
[15, (97505755694356382817881959832717013755620551362654128955029190924747025549326 : 39856815248295663243990443767776362321337592747889787217974905533720651000664 : 1)]
[16, (104059883622109321374094289636044428849728529177856482232626205340719788190730 : 112122903140080327253741791678230372394936108416576609264408917599318947489825 : 1)]
[17, (100862081773581120499222301212791081193994281440454033593790618293887747050036 : 29883864782608871580821802176208615141762369223249393426421538275393411672951 : 1)]
[18, (38901272619685732968285380035171577070479117282397203902622597987558769928140 : 87393127487643849618870152207476122589010570440825041333620493866032028851544 : 1)]
[19, (19588375357829479297593261744848590434972900972071148260168833594658324503404 : 60568592333449737531184420002591396163903580402725242236305558432410218044282 : 1)]
[20, (34773495056115281091786765947597603724784643419904767525769502836017890139287 : 8470533044743364938367028725608288731153024648869546164814808839694950063162 : 1)]
[21, (24049875635381557237058143631624836741422505207761609709712554171343558302165 : 22669890352939653242079781319904043788036611953081321775127194249638113810828 : 1)]
[22, (29908081367423272746086114569421970207888665320998202915346633185016778189308 : 19705544727792599099830884487151299095417296550955739824847212341657057716097 : 1)]
[23, (21545045623056848826483343441081830815719530893582365358444562918095175994431 : 1296978981679745807043951140304019026881137717020402959957988455650813508967 : 1)]
[24, (115090238283566018960826468250608273126387416636633736439689841211757211870926 : 47185183227829754668635270747409548752084785367264057948864458978444304762303 : 1)]
[25, (66165162229742397718677620062386824252848999675912518712054484685772795754260 : 52018513869565587577673992057861898728543589604141463438466108080111932355586 : 1)]
[26, (46375854666189782329411331467438732923135312366454677774518044107217916677258 : 28872066516664221627799718496556756366588329842312456769228220433104069963108 : 1)]
[27, (99023490166718961467148584643029653267652245207820783364668071358307234645801 : 75362751621984629832705305750958516370071248757681753180287377123479199292501 : 1)]
[28, (38862517885349586199469132990077977525522399615397327331631717567532241615208 : 56796032415390392137148811074183321813766115156763923072036584114852967736264 : 1)]
[29, (88789495143442116025801984763830218317601484092281216301053684219001740388315 : 14971629676138079947354454610178388572791590863859394042797260533911845233794 : 1)]
[30, (49378132684229722274313556995573891527709373183446262831552359577455015004672 : 78123232289538034746933569305416412888858560602643272431489024958214987548923 : 1)]
[31, (48009403158434809478298710137233764200988036438868259456275038304221065242292 : 101379581344212856035375194820281365028426536613141130008386086305632315345538 : 1)]
[32, (95440839670107969455973995843666399663662641812074432045896568980475242364517 : 67400892360194400039319989411395972789004161889863182881857158544061243615929 : 1)]
[33, (10219441022991940610048493520113102240595005085840974180672104038719657072293 : 84023467742492607926612431243360899514584580916128500081114886405247779677078 : 1)]
[34, (12619776604307790469550660645393525758448419897555601226868753617320214526993 : 86272100689574882152938150858861318820088413186167100601966648021512258522745 : 1)]
[35, (43584328072464330665967763306297595761508151294385275883849271528835646125177 : 1171731419844835688478928898148416329180259014376715189840427072871218252873 : 1)]
[36, (101419098787597942766661010883841213675986572091206578880178916574081925093625 : 53748097764673089702489673031527129553025318704228137363806494938199580582828 : 1)]
[37, (44696466249196887777481833878429299174322536392992392205634510941844339159869 : 58341336599715296255997469230977942456412351469447624645098110293822755987119 : 1)]
[38, (82592391416753704330480457266605199466589998476548643675167586509583694299127 : 96352244311289141626709213538144106127822954871227876742730890119647945927428 : 1)]
[39, (58245954963044076335222193032419637688317373475605757277584156718458924469103 : 12764036181290433088658499435961200322530176588733628912045896254235383420282 : 1)]
[40, (65977930378964483966842705159007630837451149704819265634327747226133817150731 : 106574384264472205627876631445935175739834375489227447805380155393950263965849 : 1)]
[41, (55442706224332212356956949983947160877073898960448236395042968736464621521147 : 5905242281663190858892708265754696019921609450612128937011632221309721495543 : 1)]
[42, (115136800820456833737994126771386015026287095034625623644186278108926690779567 : 3479535755779840016334846590594739014278212596066547564422106861430200972724 : 1)]
[43, (96414945312501980282409358461754977502747357521062737878469375231739675541449 : 108016644921439980219149763541432916357155273945921323318636524851968650287411 : 1)]
[44, (42072772011086351294328511389423850314698152445154323541536957340534349973349 : 99133657745585934968186133288050721248258413615930917407282740640761199917928 : 1)]
[45, (2069755349039566255304036353648839232649715781170511813011535420394543798627 : 53173698995439924366951845531266805314230463309822098990695656330917108292762 : 1)]
[46, (112485767891133126222498548010271946438760990210983300801299715976951536768791 : 85739109496996784368776054024999276184984966609644199395125789597014054674947 : 1)]
[47, (54253141229701892740678441538472478126466317116121420289154985997987923385716 : 67647191893224491627918802490479062705030965032432110320079555712709270724822 : 1)]
[48, (50111670963408569345385204828013406423962206186815367070190059614189255189955 : 96344650049071302355595011727277439354119658646232861677212062449792674989672 : 1)]
[49, (109846273198995465046214558810696509369395695668678477567979041624391316796720 : 101711840700253487202274292900077312932162220876743713596510869779955653950519 : 1)]
[50, (18752372355191540835222161239240920883340654532661984440989362140194381601434 : 88478450163343634110113046083156231725329016889379853417393465962619872936244 : 1)]

2020年11月15日日曜日

201115

PARI


A338864, A338865, A338870 とA338871

それぞれのT(n;u) に関する関係式を確認してみた。

T(n) = if(n==0, 1, u*(n-1)!*sum(k=1, n, k*numdiv(k)*T(n-k)/(n-k)!));
print("A338864");
for(n=0, 10, print(n, " ", Vecrev(T(n))))

T(n) = if(n==0, 1, u*(n-1)!*sum(k=1, n, k*sigma(k)*T(n-k)/(n-k)!));
print("A338865");
for(n=0, 10, print(n, " ", Vecrev(T(n))))

T(n) = if(n==0, 1, u*sum(k=1, n, binomial(n-1, k-1)*numdiv(k)*T(n-k)));
print("A338870");
for(n=0, 10, print(n, " ", Vecrev(T(n))))

T(n) = if(n==0, 1, u*sum(k=1, n, binomial(n-1, k-1)*sigma(k)*T(n-k)));
print("A338871");
for(n=0, 10, print(n, " ", Vecrev(T(n))))

出力結果
A338864
0 [1]
1 [0, 1]
2 [0, 4, 1]
3 [0, 12, 12, 1]
4 [0, 72, 96, 24, 1]
5 [0, 240, 840, 360, 40, 1]
6 [0, 2880, 7200, 4920, 960, 60, 1]
7 [0, 10080, 70560, 65520, 19320, 2100, 84, 1]
8 [0, 161280, 745920, 887040, 362880, 58800, 4032, 112, 1]
9 [0, 1088640, 7983360, 12640320, 6652800, 1481760, 150192, 7056, 144, 1]
10 [0, 14515200, 105235200, 185068800, 123076800, 35441280, 4898880, 337680, 11520, 180, 1]
A338865
0 [1]
1 [0, 1]
2 [0, 6, 1]
3 [0, 24, 18, 1]
4 [0, 168, 204, 36, 1]
5 [0, 720, 2280, 780, 60, 1]
6 [0, 8640, 25200, 14400, 2100, 90, 1]
7 [0, 40320, 292320, 252000, 58800, 4620, 126, 1]
8 [0, 604800, 3729600, 4334400, 1486800, 183120, 8904, 168, 1]
9 [0, 4717440, 46811520, 76265280, 35743680, 6335280, 474768, 15624, 216, 1]
10 [0, 65318400, 696729600, 1368057600, 844603200, 203001120, 21576240, 1078560, 25560, 270, 1]
A338870
0 [1]
1 [0, 1]
2 [0, 2, 1]
3 [0, 2, 6, 1]
4 [0, 3, 20, 12, 1]
5 [0, 2, 55, 80, 20, 1]
6 [0, 4, 142, 405, 220, 30, 1]
7 [0, 2, 322, 1792, 1785, 490, 42, 1]
8 [0, 4, 779, 7224, 12152, 5810, 952, 56, 1]
9 [0, 3, 1608, 27323, 73920, 56532, 15498, 1680, 72, 1]
10 [0, 4, 3894, 99690, 414815, 482160, 204204, 35910, 2760, 90, 1]
A338871
0 [1]
1 [0, 1]
2 [0, 3, 1]
3 [0, 4, 9, 1]
4 [0, 7, 43, 18, 1]
5 [0, 6, 155, 175, 30, 1]
6 [0, 12, 511, 1230, 485, 45, 1]
7 [0, 8, 1442, 7231, 5600, 1085, 63, 1]
8 [0, 15, 4131, 37870, 52381, 18550, 2114, 84, 1]
9 [0, 13, 10323, 181063, 426006, 253281, 50022, 3738, 108, 1]
10 [0, 18, 28171, 818760, 3128245, 2956065, 937587, 116760, 6150, 135, 1]

2020年11月10日火曜日

201110

PARI


A008298 とA075525

Product_{k>0} (1 - x^k)^(-u)
= 1 + u*x/1! + (3*u+u^2)*x^2/2! + (8*u+9*u^2+u^3)*x^3/3! + ...
のx^k/k!の係数部分すなわち
 1, u, 3*u+u^2, 8*u+9*u^2+u^3, ...
を出力してみた。
同様に
Product_{k>0} (1 + x^k)^u
= 1 + u*x/1! + (u+u^2)*x^2/2! + (8*u+3*u^2+u^3)*x^3/3! + ...
のx^k/k!の係数部分すなわち
 1, u, u+u^2, 8*u+3*u^2+u^3, ...
も出力してみた。

N=10; x='x+O('x^N);
a(n) = sigma(n);
Vec(serlaplace(exp(sum(n=1, N, u*a(n)*x^n/n))))

a(n) = sumdiv(n, d, (-1)^(d+1)*n/d);
Vec(serlaplace(exp(sum(n=1, N, u*a(n)*x^n/n))))

出力結果
%3 = [1, u, u^2 + 3*u, u^3 + 9*u^2 + 8*u, u^4 + 18*u^3 + 59*u^2 + 42*u, u^5 + 30*u^4 + 215*u^3 + 450*u^2 + 144*u, u^6 + 45*u^5 + 565*u^4 + 2475*u^3 + 3394*u^2 + 1440*u, u^7 + 63*u^6 + 1225*u^5 + 9345*u^4 + 28294*u^3 + 30912*u^2 + 5760*u, u^8 + 84*u^7 + 2338*u^6 + 27720*u^5 + 147889*u^4 + 340116*u^3 + 293292*u^2 + 75600*u, u^9 + 108*u^8 + 4074*u^7 + 69552*u^6 + 579369*u^5 + 2341332*u^4 + 4335596*u^3 + 3032208*u^2 + 524160*u]
%5 = [1, u, u^2 + u, u^3 + 3*u^2 + 8*u, u^4 + 6*u^3 + 35*u^2 + 6*u, u^5 + 10*u^4 + 95*u^3 + 110*u^2 + 144*u, u^6 + 15*u^5 + 205*u^4 + 585*u^3 + 1594*u^2 + 480*u, u^7 + 21*u^6 + 385*u^5 + 1995*u^4 + 8974*u^3 + 8064*u^2 + 5760*u, u^8 + 28*u^7 + 658*u^6 + 5320*u^5 + 35329*u^4 + 70252*u^3 + 125292*u^2 + 5040*u, u^9 + 36*u^8 + 1050*u^7 + 12096*u^6 + 110649*u^5 + 392364*u^4 + 1178540*u^3 + 684144*u^2 + 524160*u]

2020年11月4日水曜日

201104

Ruby


ゴロム定規

最短ゴロム定規を出力してみた。

def is_Golomb_ruler(ary)
  n = ary.size
  a = []
  (0..n - 2).each{|i|
    (i + 1..n - 1).each{|j|
      k = ary[j] - ary[i]
      if a.include?(k)
        return false
      else
        a << k
      end
    }
  }
  true
end

# 対称型を含む
def A(deg, l)
  a = []
  (1..l).to_a.combination(deg - 1){|c|
    ary = [0] + c
    a << ary if is_Golomb_ruler(ary)
  }
  a
end

# 対称型を省く
def B(deg, l)
  a = []
  A(deg, l).each{|ary|
    if !a.include?(ary.map{|i| ary[-1] - i}.reverse)
      a << ary
      p ary
    end
  }
end

B(2,  1)
B(3,  3)
B(4,  6)
B(5, 11)
B(6, 17)
B(7, 25)

出力結果
[0, 1]
[0, 1, 3]
[0, 1, 4, 6]
[0, 1, 4, 9, 11]
[0, 2, 7, 8, 11]
[0, 1, 4, 10, 12, 17]
[0, 1, 4, 10, 15, 17]
[0, 1, 8, 11, 13, 17]
[0, 1, 8, 12, 14, 17]
[0, 1, 4, 10, 18, 23, 25]
[0, 1, 7, 11, 20, 23, 25]
[0, 1, 11, 16, 19, 23, 25]
[0, 2, 3, 10, 16, 21, 25]
[0, 2, 7, 13, 21, 22, 25]

2020年10月20日火曜日

201020(2)

Crystal


A006950(2)

先程と同様にCrystal に書き換えてみた。

def a006950(n)
  return 1 if n < 3
  a = (1..n - 1).map{|i| [i]}
  ary = [[n]]
  while a.size != 0
    b = Array(Array(Int32)).new
    a.each{|i|
      x = i[-1].to_i
      s = n - i.sum
      t = x % 2
      (x + t..s - 1).each{|j| b << i.clone + [j]}
      ary << i.clone + [s] if s >= x + t
    }
    a = b
  end
  ary.size
end

p (0..90).map{|i| a006950(i)}

出力結果
[1, 1, 1, 2, 3, 4, 5, 7, 10, 13, 16, 21, 28, 35, 43, 55, 70, 86, 105, 130, 161, 196, 236, 287, 350, 420, 501, 602, 722, 858, 1016, 1206, 1431, 1687, 1981, 2331, 2741, 3206, 3740, 4368, 5096, 5922, 6868, 7967, 9233, 10670, 12306, 14193, 16357, 18803, 21581, 24766, 28394, 32490, 37128, 42411, 48406, 55159, 62777, 71416, 81182, 92152, 104494, 118434, 134131, 151725, 171467, 193676, 218607, 246491, 277691, 312677, 351841, 395537, 444314, 498852, 559727, 627509, 703002, 787171, 880896, 985043, 1100775, 1229494, 1372499, 1531086, 1706958, 1902121, 2118469, 2357947, 2623017]

201020

Crystal


A316384(2)

Crystal ではinject ではなく、reduce だが、
和の場合はsum が使える。

def f(ary)
  f_ary = Array(Int32).new
  while !(ary.all?{|i| i == 0})
    a = Array(Int32).new
    s = 0
    ary.each{|i|
      if i == 1
        a << 0
        s += 1
      elsif i > 0
        a << i - 2
        s += 2
      end
    }
    ary = a
    f_ary << s
  end
  f_ary
end

def a316384(n)
  return 1 if n < 3
  a = (1..n - 1).map{|i| [i]}
  ary = Array(Array(Int32)).new
  while a.size != 0
    b = Array(Array(Int32)).new
    a.each{|i|
      x = i[-1].to_i
      s = n - i.sum
      t = x % 2
      (x + t..s - 1).each{|j| b << i.clone + [j]}
      ary << i.clone + [s] if s >= x + t
    }
    a = b
  end
  ary.select{|i| i.reverse == f(i)}.size
end

p (0..90).map{|i| a316384(i)}

出力結果
[1, 1, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 4, 2, 5, 2, 5, 2, 6, 3, 8, 4, 9, 4, 10, 4, 12, 6, 15, 7, 17, 7, 19, 8, 22, 10, 26, 12, 30, 13, 33, 14, 38, 17, 45, 21, 51, 22, 56, 24, 64, 29, 74, 33, 83, 36, 92, 40, 104, 46, 119, 53, 133, 58, 147, 63, 165, 73, 187, 83, 208, 90, 229, 99, 256, 113, 288, 127, 319, 138, 351, 152, 390, 171, 435, 191, 481]

2020年10月16日金曜日

201016

Crystal


Number of solutions to +- 1 +- 2 +- 3 +- ... +- n = 0(6)

以下を用いて、n が4000 のときの値を求めることはおすすめしない。

require "big"

def a063865(n)
  ary = [1.to_big_i]
  m = n * (n + 1) // 4
  a = Array.new(m + 1){0.to_big_i}
  a[0] = 1.to_big_i
  (1..n).each{|i|
    b = a.clone
    (0..[(i - 1) * i / 2, m - i].min).each{|k| b[k + i] += a[k]}
    a = b
    i * (i + 1) % 4 == 0 ? ary << a[i * (i + 1) // 4] : ary << 0.to_big_i
  }
  ary
end

p a063865(1000)[-1]

出力結果
467708586991053780130476928496471502490480200263913521598374850751872554493810444457551220080062611698129340084492921358002542871554381676735263500063986630523649271451391806356678763700553308953903873511563867155215734010997332808966175771715884247295296277348179194597363883854664431808932677416

2020年10月10日土曜日

201010

Python


足し算と引き算だけで円を描く(3)

Python で書いてみた。

def A(r):
    xy = [['□' for _ in range(r + 1)] for _ in range(r + 1)]
    a, x, y = r, 0, r
    while x <= y:
        xy[x][y], xy[y][x] = '■', '■'
        a, x = a - x - x - 1, x + 1
        if a < 0:
            a, y = a + y + y - 1, y - 1 
    for i in xy:
        print(''.join(i))

for i in range(21):
    A(i)

出力結果
□■
■■
□□■
□□■
■■□
□□□■
□□□■
□□■□
■■□□
□□□□■
□□□□■
□□□□■
□□□■□
■■■□□
□□□□□■
□□□□□■
□□□□□■
□□□□■□
□□□■□□
■■■□□□
□□□□□□■
□□□□□□■
□□□□□□■
□□□□□■□
□□□□□■□
□□□■■□□
■■■□□□□
□□□□□□□■
□□□□□□□■
□□□□□□□■
□□□□□□■□
□□□□□□■□
□□□□□■□□
□□□■■□□□
■■■□□□□□
□□□□□□□□■
□□□□□□□□■
□□□□□□□□■
□□□□□□□■□
□□□□□□□■□
□□□□□□■□□
□□□□□■■□□
□□□■■□□□□
■■■□□□□□□
□□□□□□□□□■
□□□□□□□□□■
□□□□□□□□□■
□□□□□□□□□■
□□□□□□□□■□
□□□□□□□□■□
□□□□□□□■□□
□□□□□□■□□□
□□□□■■□□□□
■■■■□□□□□□
□□□□□□□□□□■
□□□□□□□□□□■
□□□□□□□□□□■
□□□□□□□□□□■
□□□□□□□□□■□
□□□□□□□□□■□
□□□□□□□□■□□
□□□□□□□■□□□
□□□□□□■□□□□
□□□□■■□□□□□
■■■■□□□□□□□
□□□□□□□□□□□■
□□□□□□□□□□□■
□□□□□□□□□□□■
□□□□□□□□□□□■
□□□□□□□□□□■□
□□□□□□□□□□■□
□□□□□□□□□■□□
□□□□□□□□□■□□
□□□□□□□□■□□□
□□□□□□■■□□□□
□□□□■■□□□□□□
■■■■□□□□□□□□
□□□□□□□□□□□□■
□□□□□□□□□□□□■
□□□□□□□□□□□□■
□□□□□□□□□□□□■
□□□□□□□□□□□■□
□□□□□□□□□□□■□
□□□□□□□□□□■□□
□□□□□□□□□□■□□
□□□□□□□□□■□□□
□□□□□□□□■□□□□
□□□□□□■■□□□□□
□□□□■■□□□□□□□
■■■■□□□□□□□□□
□□□□□□□□□□□□□■
□□□□□□□□□□□□□■
□□□□□□□□□□□□□■
□□□□□□□□□□□□□■
□□□□□□□□□□□□■□
□□□□□□□□□□□□■□
□□□□□□□□□□□□■□
□□□□□□□□□□□■□□
□□□□□□□□□□■□□□
□□□□□□□□□□■□□□
□□□□□□□□■■□□□□
□□□□□□□■□□□□□□
□□□□■■■□□□□□□□
■■■■□□□□□□□□□□
□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□■
□□□□□□□□□□□□□■□
□□□□□□□□□□□□□■□
□□□□□□□□□□□□□■□
□□□□□□□□□□□□■□□
□□□□□□□□□□□□■□□
□□□□□□□□□□□■□□□
□□□□□□□□□□■□□□□
□□□□□□□□□■□□□□□
□□□□□□□■■□□□□□□
□□□□■■■□□□□□□□□
■■■■□□□□□□□□□□□
□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□■□□
□□□□□□□□□□□□■□□□
□□□□□□□□□□□■□□□□
□□□□□□□□□□■□□□□□
□□□□□□□□□■□□□□□□
□□□□□□□■■□□□□□□□
□□□□■■■□□□□□□□□□
■■■■□□□□□□□□□□□□
□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□■□□□□
□□□□□□□□□□□■□□□□□
□□□□□□□□□■■□□□□□□
□□□□□□□■■□□□□□□□□
□□□□□■■□□□□□□□□□□
■■■■■□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□■□□□□
□□□□□□□□□□□□■□□□□□
□□□□□□□□□□□■□□□□□□
□□□□□□□□□□■□□□□□□□
□□□□□□□□■■□□□□□□□□
□□□□□■■■□□□□□□□□□□
■■■■■□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□□■□□□□
□□□□□□□□□□□□□□■□□□□
□□□□□□□□□□□□□■□□□□□
□□□□□□□□□□□■■□□□□□□
□□□□□□□□□□■□□□□□□□□
□□□□□□□□■■□□□□□□□□□
□□□□□■■■□□□□□□□□□□□
■■■■■□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□□□■□□□□
□□□□□□□□□□□□□□■□□□□□
□□□□□□□□□□□□□■□□□□□□
□□□□□□□□□□□□■□□□□□□□
□□□□□□□□□□■■□□□□□□□□
□□□□□□□□■■□□□□□□□□□□
□□□□□■■■□□□□□□□□□□□□
■■■■■□□□□□□□□□□□□□□□
□□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□□■
□□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□□□■□
□□□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□□□□■□□
□□□□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□□□□□■□□□
□□□□□□□□□□□□□□□□■□□□□
□□□□□□□□□□□□□□□■□□□□□
□□□□□□□□□□□□□□■□□□□□□
□□□□□□□□□□□□□■□□□□□□□
□□□□□□□□□□□□■□□□□□□□□
□□□□□□□□□□■■□□□□□□□□□
□□□□□□□□■■□□□□□□□□□□□
□□□□□■■■□□□□□□□□□□□□□
■■■■■□□□□□□□□□□□□□□□□

2020年10月9日金曜日

201009

Ruby


足し算と引き算だけで円を描く(2)

文字コードの設定が変わると出力がかわる。
chcp で932 の場合は
chcp 65001 で変更すればよい。