Desafío: Cuadrados e Invertidos.

Bueno el segundo desafío que nos presenta lwayar en su sitio RetroNet.
Esta vez (seguí utilizando GNU/Octave 3.0.1) y escribí el siguiente código que funciona y relativamente rápido y además escibí el código en fortran 90.
 http://d1.scribdassets.com/ScribdViewer.swf?document_id=46644376&access_key=key-1dcm5vpxjn2tdrka99lz&page=1&viewMode=listLa cantidad de números que encontre fue de 359.

Para que vean, esta es al lista, el orden es el número 1, el número 2, el cuadraro del número 1 y el cuadrado del número dos:
11 11 121 121
12 21 144 441
13 31 169 961
21 12 441 144
22 22 484 484
31 13 961 169
101 101 10201 10201
102 201 10404 40401
103 301 10609 90601
111 111 12321 12321
112 211 12544 44521
113 311 12769 96721
121 121 14641 14641
122 221 14884 48841
201 102 40401 10404
202 202 40804 40804
211 112 44521 12544
212 212 44944 44944
221 122 48841 14884
301 103 90601 10609
311 113 96721 12769
1001 1001 1002001 1002001
1002 2001 1004004 4004001
1003 3001 1006009 9006001
1011 1101 1022121 1212201
1012 2101 1024144 4414201
1013 3101 1026169 9616201
1021 1201 1042441 1442401
1022 2201 1044484 4844401
1031 1301 1062961 1692601
1101 1011 1212201 1022121
1102 2011 1214404 4044121
1103 3011 1216609 9066121
1111 1111 1234321 1234321
1112 2111 1236544 4456321
1113 3111 1238769 9678321
1121 1211 1256641 1466521
1122 2211 1258884 4888521
1201 1021 1442401 1042441
1202 2021 1444804 4084441
1211 1121 1466521 1256641
1212 2121 1468944 4498641
1301 1031 1692601 1062961
2001 1002 4004001 1004004
2002 2002 4008004 4008004
2011 1102 4044121 1214404
2012 2102 4048144 4418404
2021 1202 4084441 1444804
2022 2202 4088484 4848804
2101 1012 4414201 1024144
2102 2012 4418404 4048144
2111 1112 4456321 1236544
2121 1212 4498641 1468944
2201 1022 4844401 1044484
2202 2022 4848804 4088484
2211 1122 4888521 1258884
3001 1003 9006001 1006009
3011 1103 9066121 1216609
3101 1013 9616201 1026169
3111 1113 9678321 1238769
10001 10001 100020001 100020001
10002 20001 100040004 400040001
10003 30001 100060009 900060001
10011 11001 100220121 121022001
10012 21001 100240144 441042001
10013 31001 100260169 961062001
10021 12001 100420441 144024001
10022 22001 100440484 484044001
10031 13001 100620961 169026001
10101 10101 102030201 102030201
10102 20101 102050404 404050201
10103 30101 102070609 906070201
10111 11101 102232321 123232201
10112 21101 102252544 445252201
10113 31101 102272769 967272201
10121 12101 102434641 146434201
10122 22101 102454884 488454201
10201 10201 104060401 104060401
10202 20201 104080804 408080401
10211 11201 104264521 125462401
10212 21201 104284944 449482401
10221 12201 104468841 148864401
11001 10011 121022001 100220121
11002 20011 121044004 400440121
11003 30011 121066009 900660121
11011 11011 121242121 121242121
11012 21011 121264144 441462121
11013 31011 121286169 961682121
11021 12011 121462441 144264121
11022 22011 121484484 484484121
11031 13011 121682961 169286121
11101 10111 123232201 102232321
11102 20111 123254404 404452321
11103 30111 123276609 906672321
11111 11111 123454321 123454321
11112 21111 123476544 445674321
11113 31111 123498769 967894321
11121 12111 123676641 146676321
11122 22111 123698884 488896321
11201 10211 125462401 104264521
11202 20211 125484804 408484521
11211 11211 125686521 125686521
12001 10021 144024001 100420441
12002 20021 144048004 400840441
12011 11021 144264121 121462441
12012 21021 144288144 441882441
12101 10121 146434201 102434641
12102 20121 146458404 404854641
12111 11121 146676321 123676641
12201 10221 148864401 104468841
12202 20221 148888804 408888841
13001 10031 169026001 100620961
13011 11031 169286121 121682961
20001 10002 400040001 100040004
20002 20002 400080004 400080004
20011 11002 400440121 121044004
20012 21002 400480144 441084004
20021 12002 400840441 144048004
20022 22002 400880484 484088004
20101 10102 404050201 102050404
20102 20102 404090404 404090404
20111 11102 404452321 123254404
20112 21102 404492544 445294404
20121 12102 404854641 146458404
20122 22102 404894884 488498404
20201 10202 408080401 104080804
20211 11202 408484521 125484804
20221 12202 408888841 148888804
21001 10012 441042001 100240144
21002 20012 441084004 400480144
21011 11012 441462121 121264144
21021 12012 441882441 144288144
21101 10112 445252201 102252544
21102 20112 445294404 404492544
21111 11112 445674321 123476544
21201 10212 449482401 104284944
22001 10022 484044001 100440484
22002 20022 484088004 400880484
22011 11022 484484121 121484484
22101 10122 488454201 102454884
22102 20122 488498404 404894884
22111 11122 488896321 123698884
30001 10003 900060001 100060009
30011 11003 900660121 121066009
30101 10103 906070201 102070609
30111 11103 906672321 123276609
31001 10013 961062001 100260169
31011 11013 961682121 121286169
31101 10113 967272201 102272769
31111 11113 967894321 123498769
100001 100001 10000200001 10000200001
100002 200001 10000400004 40000400001
100003 300001 10000600009 90000600001
100011 110001 10002200121 12100220001
100012 210001 10002400144 44100420001
100013 310001 10002600169 96100620001
100021 120001 10004200441 14400240001
100022 220001 10004400484 48400440001
100031 130001 10006200961 16900260001
100101 101001 10020210201 10201202001
100102 201001 10020410404 40401402001
100103 301001 10020610609 90601602001
100111 111001 10022212321 12321222001
100112 211001 10022412544 44521422001
100113 311001 10022612769 96721622001
100121 121001 10024214641 14641242001
100122 221001 10024414884 48841442001
100201 102001 10040240401 10404204001
100202 202001 10040440804 40804404001
100211 112001 10042244521 12544224001
100212 212001 10042444944 44944424001
100221 122001 10044248841 14884244001
100301 103001 10060290601 10609206001
100311 113001 10062296721 12769226001
101001 100101 10201202001 10020210201
101002 200101 10201404004 40040410201
101003 300101 10201606009 90060610201
101011 110101 10203222121 12122230201
101012 210101 10203424144 44142430201
101013 310101 10203626169 96162630201
101021 120101 10205242441 14424250201
101022 220101 10205444484 48444450201
101031 130101 10207262961 16926270201
101101 101101 10221412201 10221412201
101102 201101 10221614404 40441612201
101103 301101 10221816609 90661812201
101111 111101 10223434321 12343432201
101112 211101 10223636544 44563632201
101113 311101 10223838769 96783832201
101121 121101 10225456641 14665452201
101122 221101 10225658884 48885652201
101201 102101 10241642401 10424614201
101202 202101 10241844804 40844814201
101211 112101 10243666521 12566634201
101212 212101 10243868944 44986834201
101301 103101 10261892601 10629816201
102001 100201 10404204001 10040240401
102002 200201 10404408004 40080440401
102011 110201 10406244121 12144260401
102012 210201 10406448144 44184460401
102021 120201 10408284441 14448280401
102022 220201 10408488484 48488480401
102101 101201 10424614201 10241642401
102102 201201 10424818404 40481842401
102111 111201 10426656321 12365662401
102121 121201 10428698641 14689682401
103001 100301 10609206001 10060290601
103101 101301 10629816201 10261892601
110001 100011 12100220001 10002200121
110002 200011 12100440004 40004400121
110003 300011 12100660009 90006600121
110011 110011 12102420121 12102420121
110012 210011 12102640144 44104620121
110013 310011 12102860169 96106820121
110021 120011 12104620441 14402640121
110022 220011 12104840484 48404840121
110031 130011 12106820961 16902860121
110101 101011 12122230201 10203222121
110102 201011 12122450404 40405422121
110103 301011 12122670609 90607622121
110111 111011 12124432321 12323442121
110112 211011 12124652544 44525642121
110113 311011 12124872769 96727842121
110121 121011 12126634641 14643662121
110122 221011 12126854884 48845862121
110201 102011 12144260401 10406244121
110202 202011 12144480804 40808444121
110211 112011 12146464521 12546464121
110212 212011 12146684944 44948664121
110221 122011 12148668841 14886684121
111001 100111 12321222001 10022212321
111002 200111 12321444004 40044412321
111003 300111 12321666009 90066612321
111011 110111 12323442121 12124432321
111012 210111 12323664144 44146632321
111013 310111 12323886169 96168832321
111021 120111 12325662441 14426652321
111022 220111 12325884484 48448852321
111031 130111 12327882961 16928872321
111101 101111 12343432201 10223434321
111102 201111 12343654404 40445634321
111103 301111 12343876609 90667834321
111111 111111 12345654321 12345654321
111112 211111 12345876544 44567854321
111121 121111 12347876641 14667874321
111201 102111 12365662401 10426656321
111202 202111 12365884804 40848856321
111211 112111 12367886521 12568876321
112001 100211 12544224001 10042244521
112002 200211 12544448004 40084444521
112011 110211 12546464121 12146464521
112012 210211 12546688144 44188664521
112101 101211 12566634201 10243666521
112102 201211 12566858404 40485866521
112111 111211 12568876321 12367886521
113001 100311 12769226001 10062296721
120001 100021 14400240001 10004200441
120002 200021 14400480004 40008400441
120011 110021 14402640121 12104620441
120012 210021 14402880144 44108820441
120101 101021 14424250201 10205242441
120102 201021 14424490404 40409442441
120111 111021 14426652321 12325662441
120112 211021 14426892544 44529862441
120201 102021 14448280401 10408284441
121001 100121 14641242001 10024214641
121002 200121 14641484004 40048414641
121011 110121 14643662121 12126634641
121101 101121 14665452201 10225456641
121102 201121 14665694404 40449656641
121111 111121 14667874321 12347876641
121201 102121 14689682401 10428698641
122001 100221 14884244001 10044248841
122002 200221 14884488004 40088448841
122011 110221 14886684121 12148668841
130001 100031 16900260001 10006200961
130011 110031 16902860121 12106820961
130101 101031 16926270201 10207262961
130111 111031 16928872321 12327882961
200001 100002 40000400001 10000400004
200002 200002 40000800004 40000800004
200011 110002 40004400121 12100440004
200012 210002 40004800144 44100840004
200021 120002 40008400441 14400480004
200022 220002 40008800484 48400880004
200101 101002 40040410201 10201404004
200102 201002 40040810404 40401804004
200111 111002 40044412321 12321444004
200112 211002 40044812544 44521844004
200121 121002 40048414641 14641484004
200122 221002 40048814884 48841884004
200201 102002 40080440401 10404408004
200202 202002 40080840804 40804808004
200211 112002 40084444521 12544448004
200212 212002 40084844944 44944848004
200221 122002 40088448841 14884488004
201001 100102 40401402001 10020410404
201002 200102 40401804004 40040810404
201011 110102 40405422121 12122450404
201012 210102 40405824144 44142850404
201021 120102 40409442441 14424490404
201022 220102 40409844484 48444890404
201101 101102 40441612201 10221614404
201111 111102 40445634321 12343654404
201121 121102 40449656641 14665694404
201201 102102 40481842401 10424818404
201211 112102 40485866521 12566858404
202001 100202 40804404001 10040440804
202002 200202 40804808004 40080840804
202011 110202 40808444121 12144480804
202012 210202 40808848144 44184880804
202101 101202 40844814201 10241844804
202111 111202 40848856321 12365884804
210001 100012 44100420001 10002400144
210002 200012 44100840004 40004800144
210011 110012 44104620121 12102640144
210021 120012 44108820441 14402880144
210101 101012 44142430201 10203424144
210102 201012 44142850404 40405824144
210111 111012 44146632321 12323664144
210201 102012 44184460401 10406448144
210202 202012 44184880804 40808848144
210211 112012 44188664521 12546688144
211001 100112 44521422001 10022412544
211002 200112 44521844004 40044812544
211011 110112 44525642121 12124652544
211021 120112 44529862441 14426892544
211101 101112 44563632201 10223636544
211111 111112 44567854321 12345876544
212001 100212 44944424001 10042444944
212002 200212 44944848004 40084844944
212011 110212 44948664121 12146684944
212101 101212 44986834201 10243868944
220001 100022 48400440001 10004400484
220002 200022 48400880004 40008800484
220011 110022 48404840121 12104840484
220101 101022 48444450201 10205444484
220102 201022 48444890404 40409844484
220111 111022 48448852321 12325884484
220201 102022 48488480401 10408488484
221001 100122 48841442001 10024414884
221002 200122 48841884004 40048814884
221011 110122 48845862121 12126854884
221101 101122 48885652201 10225658884
300001 100003 90000600001 10000600009
300011 110003 90006600121 12100660009
300101 101003 90060610201 10201606009
300111 111003 90066612321 12321666009
301001 100103 90601602001 10020610609
301011 110103 90607622121 12122670609
301101 101103 90661812201 10221816609
301111 111103 90667834321 12343876609
310001 100013 96100620001 10002600169
310011 110013 96106820121 12102860169
310101 101013 96162630201 10203626169
310111 111013 96168832321 12323886169
311001 100113 96721622001 10022612769
311011 110113 96727842121 12124872769
311101 101113 96783832201 10223838769

Al principio hice una muy mala programación, malísima. Supongo que porque hace tiempo que no programaba un algoritmo de este tipo. Por lo menos me hizo ver los errores que cometí y por suerte creo que los pude corregir.

Ojalá este acertado… bueno lwayar me lo va a decir…

2 thoughts on “Desafío: Cuadrados e Invertidos.

  1. http://dream-analysis.org says:

    I simply wanted to thank you one more time for that amazing web site you have produced here. It is full of useful tips for those who are actually interested in this specific subject, in particular this very post. Your all so sweet as well as thoughtful of others as well as reading the blog posts is a good delight if you ask me. And what a generous treat! Mary and I will certainly have excitement making use of your tips in what we have to do in a month’s time. Our list is a distance long which means your tips will definitely be put to good use.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s