Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11220 > unrolled thread
| Started by | Diana Mecum <diana.mecum@gmail.com> |
|---|---|
| First post | 2012-08-05 02:25 +0000 |
| Last post | 2012-08-07 07:03 +0000 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
How to swap two elements of a list Diana Mecum <diana.mecum@gmail.com> - 2012-08-05 02:25 +0000
Re: How to swap two elements of a list Diana Mecum <diana.mecum@gmail.com> - 2012-08-05 18:59 +0000
Re: How to swap two elements of a list Diana Mecum <diana.mecum@gmail.com> - 2012-08-05 19:00 +0000
Re: How to swap two elements of a list "Nasser M. Abbasi" <nma@12000.org> - 2012-08-05 19:04 +0000
Re: How to swap two elements of a list Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2012-08-06 08:46 +0000
Re: How to swap two elements of a list Andrzej Kozlowski <akozlowski@gmail.com> - 2012-08-06 08:54 +0000
Re: How to swap two elements of a list Diana Mecum <diana.mecum@gmail.com> - 2012-08-07 07:03 +0000
| From | Diana Mecum <diana.mecum@gmail.com> |
|---|---|
| Date | 2012-08-05 02:25 +0000 |
| Subject | How to swap two elements of a list |
| Message-ID | <jvklja$643$1@smc.vnet.net> |
I would like to find a snazzy way to elements in the MASTER LIST. The method I want to use is the following:
1. Swap the first element of SWAP LIST 1, with the first element of SWAP LIST 2, in the MASTER LIST.
. . . . a. Swap the 2 and 4.
. . . . b. Swap the 3 and 8.
. . . . c. Swap the 4 and 9.
I have done it with an awkward process, by creating a new list, and parsing element by element. My Mathematica code is below.
The final result I want is:
FINAL LIST:
{4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121,17,125,128,169,243,19,256,289,343,23,361,512,529,625,29,729,841,961,1024,1331,1369,1681,1849,31,37,2048,41,2187,2197,2209,2401,2809,3125,3481,3721,43,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,47,11449,53,11881,12167,12769,14641,15625,16129,16384,59,16807,17161,18769,19321,19683,22201,22801,61,24389,24649,26569,27889,67,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,71,73441,76729,73,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489,103823,109561,113569,117649,120409,79,121801,124609,128881,130321,131072}
MASTER LIST:
{2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31,32,37,41,43,47,49,53,59,61,64,67,71,73,79,81,83,89,97,101,103,107,109,113,121,125,127,128,131,137,139,149,151,157,163,167,169,173,179,181,191,193,197,199,211,223,227,229,233,239,241,243,251,256,257,263,269,271,277,281,283,289,293,307,311,313,317,331,337,343,347,349,353,359,361,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,512,521,523,529,541,547,557,563,569,571,577,587,593,599}
SWAP LIST 1:
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821}
SWAP LIST 2
{4,8,9,16,25,27,32,49,64,81,121,125,128,169,243,256,289,343,361,512,529,625,729,841,961,1024,1331,1369,1681,1849,2048,2187,2197,2209,2401,2809,3125,3481,3721,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,11449,11881,12167,12769,14641,15625,16129,16384,16807,17161,18769,19321,19683,22201,22801,24389,24649,26569,27889,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,73441,76729,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489,103823,109561,113569,117649,120409,121801,124609,128881,130321,131072,134689,139129,143641,146689,148877,151321,157609,160801,161051,167281,175561,177147,177241,185761,187489,192721,196249,201601,205379,208849,212521,214369,218089}
MY CURRENT MATHEMATICA CODE:
Table[A000961Working[[n]],{n,1,130}]
{2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31,32,37,41,43,47,49,53,59,61,64,67,71,73,79,81,83,89,97,101,103,107,109,113,121,125,127,128,131,137,139,149,151,157,163,167,169,173,179,181,191,193,197,199,211,223,227,229,233,239,241,243,251,256,257,263,269,271,277,281,283,289,293,307,311,313,317,331,337,343,347,349,353,359,361,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,512,521,523,529,541,547,557,563,569,571,577,587,593,599}
Prime[Range[142]]
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821}
ShortList=Complement[A000961Working,Prime[Range[1000000]]]
{4,8,9,16,25,27,32,49,64,81,121,125,128,169,243,256,289,343,361,512,529,625,729,841,961,1024,1331,1369,1681,1849,2048,2187,2197,2209,2401,2809,3125,3481,3721,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,11449,11881,12167,12769,14641,15625,16129,16384,16807,17161,18769,19321,19683,22201,22801,24389,24649,26569,27889,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,73441,76729,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489,103823,109561,113569,117649,120409,121801,124609,128881,130321,131072,134689,139129,143641,146689,148877,151321,157609,160801,161051,167281,175561,177147,177241,185761,187489,192721,196249,201601,205379,208849,212521,214369,218089}
Take[Table[If[A000961Working[[i]]==Prime[Range[142]][[j]],A163813Working[[i]]=ShortList[[j]],],{i,1,142},{j,1,142}],142];
Take[Table[If[A000961Working[[i]]==ShortList[[j]],A163813Working[[i]]=Prime[Range[142]][[j]],],{i,1,142},{j,1,142}],142];
A163813=Prepend[A163813Working,1];
Take[A163813,142]
{1,4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121,17,125,128,169,243,19,256,289,343,23,361,512,529,625,29,729,841,961,1024,1331,1369,1681,1849,31,37,2048,41,2187,2197,2209,2401,2809,3125,3481,3721,43,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,47,11449,53,11881,12167,12769,14641,15625,16129,16384,59,16807,17161,18769,19321,19683,22201,22801,61,24389,24649,26569,27889,67,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,71,73441,76729,73,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489,103823,109561,113569,117649,120409,79,121801,124609,128881,130321,131072}
[toc] | [next] | [standalone]
| From | Diana Mecum <diana.mecum@gmail.com> |
|---|---|
| Date | 2012-08-05 18:59 +0000 |
| Message-ID | <jvmfpp$9nb$1@smc.vnet.net> |
| In reply to | #11220 |
Missed an important word with the topic sentence: > I would like to find a snazzy way to (SWAP) elements in the MASTER LIST.
[toc] | [prev] | [next] | [standalone]
| From | Diana Mecum <diana.mecum@gmail.com> |
|---|---|
| Date | 2012-08-05 19:00 +0000 |
| Message-ID | <jvmft9$9ot$1@smc.vnet.net> |
| In reply to | #11220 |
***,
Thank you for getting back to me. I had a little difficulty describing what I was trying to do.
I start with a list which begins as follows:
{2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31
Now, I want to swap the 2 with the 4, the 3 with the 8, the 5 with the 9. "2" is the first element of SWAP LIST 1. "4", which I want to swap with "2" is the first element of SWAP LIST 2. "3" is the second element of SWAP LIST 1. "8", which I want to swap with "3" is the second element of SWAP LIST 2. And, so on.
The resulting list is
{4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121
Hope this is more clear.
Diana
[toc] | [prev] | [next] | [standalone]
| From | "Nasser M. Abbasi" <nma@12000.org> |
|---|---|
| Date | 2012-08-05 19:04 +0000 |
| Message-ID | <jvmg3a$9pg$1@smc.vnet.net> |
| In reply to | #11220 |
On 8/4/2012 9:25 PM, Diana Mecum wrote: <snip> It is better to show a _small_ example that shows the input and the output. Also, your descrption was not clear to me at all. There was no need to show such a huge amount of data for an example. Simple lists will do. (5-6 items in the list). Making a _small_, clear and working example will result in better help. --Nasser
[toc] | [prev] | [next] | [standalone]
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| Date | 2012-08-06 08:46 +0000 |
| Message-ID | <jvo0a3$cf5$1@smc.vnet.net> |
| In reply to | #11220 |
How I understand your problem I would think the following would do:
l1 = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131,
137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197,
199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271,
277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353,
359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433,
439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,
521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601,
607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677,
683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769,
773, 787, 797, 809, 811, 821};
l2 = {4, 8, 9, 16, 25, 27, 32, 49, 64, 81, 121, 125, 128, 169, 243,
256, 289, 343, 361, 512, 529, 625, 729, 841, 961, 1024, 1331, 1369,
1681, 1849, 2048, 2187, 2197, 2209, 2401, 2809, 3125, 3481, 3721,
4096, 4489, 4913, 5041, 5329, 6241, 6561, 6859, 6889, 7921, 8192,
9409, 10201, 10609, 11449, 11881, 12167, 12769, 14641, 15625, 16129,
16384, 16807, 17161, 18769, 19321, 19683, 22201, 22801, 24389,
24649, 26569, 27889, 28561, 29791, 29929, 32041, 32761, 32768,
36481, 37249, 38809, 39601, 44521, 49729, 50653, 51529, 52441,
54289, 57121, 58081, 59049, 63001, 65536, 66049, 68921, 69169,
72361, 73441, 76729, 78125, 78961, 79507, 80089, 83521, 85849,
94249, 96721, 97969, 100489, 103823, 109561, 113569, 117649, 120409,
121801, 124609, 128881, 130321, 131072, 134689, 139129, 143641,
146689, 148877, 151321, 157609, 160801, 161051, 167281, 175561,
177147, 177241, 185761, 187489, 192721, 196249, 201601, 205379,
208849, 212521, 214369, 218089};
master = {2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, 31,
32, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81, 83,
89, 97, 101, 103, 107, 109, 113, 121, 125, 127, 128, 131, 137, 139,
149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 197, 199,
211, 223, 227, 229, 233, 239, 241, 243, 251, 256, 257, 263, 269,
271, 277, 281, 283, 289, 293, 307, 311, 313, 317, 331, 337, 343,
347, 349, 353, 359, 361, 367, 373, 379, 383, 389, 397, 401, 409,
419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487,
491, 499, 503, 509, 512, 521, 523, 529, 541, 547, 557, 563, 569,
571, 577, 587, 593, 599};
final = master /.Apply[Rule, Transpose[{Join[l1, l2], Join[l2, l1]}], {1}];
This will not match your FINAL LIST but this is longer then the master list.
final[[#]] == finalTest[[#]] & /@ Range@Length[final] gives true for all member of final...
Ulrich
Am 05.08.2012 um 20:58 schrieb Diana Mecum:
> ***,
>
> Thank you for getting back to me. I had a little difficulty describing what I was trying to do.
>
> I start with a list which begins as follows:
>
> {2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31
>
> Now, I want to swap the 2 with the 4, the 3 with the 8, the 5 with the 9. "2" is the first element of SWAP LIST 1. "4", which I want to swap with "2" is the first element of SWAP LIST 2. "3" is the second element of SWAP LIST 1. "8", which I want to swap with "3" is the second element of SWAP LIST 2. And, so on.
>
> The resulting list is
>
> {4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121
>
> Hope this is more clear.
>
> Diana
>
[toc] | [prev] | [next] | [standalone]
| From | Andrzej Kozlowski <akozlowski@gmail.com> |
|---|---|
| Date | 2012-08-06 08:54 +0000 |
| Message-ID | <jvo0oj$cgi$1@smc.vnet.net> |
| In reply to | #11220 |
On 5 Aug 2012, at 20:58, Diana Mecum wrote:
> ***,
>
> Thank you for getting back to me. I had a little difficulty describing what I was trying to do.
>
> I start with a list which begins as follows:
>
> {2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31
>
> Now, I want to swap the 2 with the 4, the 3 with the 8, the 5 with the 9. "2" is the first element of SWAP LIST 1. "4", which I want to swap with "2" is the first element of SWAP LIST 2. "3" is the second element of SWAP LIST 1. "8", which I want to swap with "3" is the second element of SWAP LIST 2. And, so on.
>
> The resulting list is
>
> {4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121
>
> Hope this is more clear.
>
> Diana
>
Well, I don't know if it is clear or not because the answer you gave in your first post seems wrong and, in particular, your Master List has length 130 and your Final List has length 141. How you can get form a list of length 130 to a list of length 141 by simply replacing elements is beyond my understanding. Assuming, however, that my interpretation of your problem is correct, a simple way to deal with it is:
swaplist1 = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347,
349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421,
431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593,
599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661,
673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757,
761, 769, 773, 787, 797, 809, 811, 821};
swaplist2 = {4, 8, 9, 16,
25, 27, 32, 49, 64, 81, 121, 125, 128, 169, 243, 256, 289, 343, 361,
512, 529, 625, 729, 841, 961, 1024, 1331, 1369, 1681, 1849, 2048,
2187, 2197, 2209, 2401, 2809, 3125, 3481, 3721, 4096, 4489, 4913,
5041, 5329, 6241, 6561, 6859, 6889, 7921, 8192, 9409, 10201, 10609,
11449, 11881, 12167, 12769, 14641, 15625, 16129, 16384, 16807,
17161, 18769, 19321, 19683, 22201, 22801, 24389, 24649, 26569,
27889, 28561, 29791, 29929, 32041, 32761, 32768, 36481, 37249,
38809, 39601, 44521, 49729, 50653, 51529, 52441, 54289, 57121,
58081, 59049, 63001, 65536, 66049, 68921, 69169, 72361, 73441,
76729, 78125, 78961, 79507, 80089, 83521, 85849, 94249, 96721,
97969, 100489, 103823, 109561, 113569, 117649, 120409, 121801,
124609, 128881, 130321, 131072, 134689, 139129, 143641, 146689,
148877, 151321, 157609, 160801, 161051, 167281, 175561, 177147,
177241, 185761, 187489, 192721, 196249, 201601, 205379, 208849,
212521, 214369, 218089};
masterlist = {2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29,
31, 32, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81,
83, 89, 97, 101, 103, 107, 109, 113, 121, 125, 127, 128, 131, 137,
139, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 197,
199, 211, 223, 227, 229, 233, 239, 241, 243, 251, 256, 257, 263,
269, 271, 277, 281, 283, 289, 293, 307, 311, 313, 317, 331, 337,
343, 347, 349, 353, 359, 361, 367, 373, 379, 383, 389, 397, 401,
409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479,
487, 491, 499, 503, 509, 512, 521, 523, 529, 541, 547, 557, 563,
569, 571, 577, 587, 593, 599};
rules1 = Rule @@@ Transpose[{swaplist1, swaplist2}];
rules2 = Reverse /@ rules1;
rules = Join[rules1, rules2];
finallist = masterlist /. rules
{4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121,17,125,128,169,243,19,256,289,343,23,361,512,529,625,29,729,841,961,1024,1331,1369,1681,1849,31,37,2048,41,2187,2197,2209,2401,2809,3125,3481,3721,43,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,47,11449,53,11881,12167,12769,14641,15625,16129,16384,59,16807,17161,18769,19321,19683,22201,22801,61,24389,24649,26569,27889,67,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,71,73441,76729,73,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489}
Andrzej Kozlowski
[toc] | [prev] | [next] | [standalone]
| From | Diana Mecum <diana.mecum@gmail.com> |
|---|---|
| Date | 2012-08-07 07:03 +0000 |
| Message-ID | <jvqek9$gtb$1@smc.vnet.net> |
| In reply to | #11220 |
Andrzej,
Thank you, this did it.
Diana M.
On Monday, August 6, 2012 1:54:43 AM UTC-7, Andrzej Kozlowski wrote:
> On 5 Aug 2012, at 20:58, Diana Mecum wrote:
>
>
>
> > ***,
>
> >
>
> > Thank you for getting back to me. I had a little difficulty describing what I was trying to do.
>
> >
>
> > I start with a list which begins as follows:
>
> >
>
> > {2,3,4,5,7,8,9,11,13,16,17,19,23,25,27,29,31
>
> >
>
> > Now, I want to swap the 2 with the 4, the 3 with the 8, the 5 with the 9. "2" is the first element of SWAP LIST 1. "4", which I want to swap with "2" is the first element of SWAP LIST 2. "3" is the second element of SWAP LIST 1. "8", which I want to swap with "3" is the second element of SWAP LIST 2. And, so on.
>
> >
>
> > The resulting list is
>
> >
>
> > {4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121
>
> >
>
> > Hope this is more clear.
>
> >
>
> > Diana
>
> >
>
>
>
>
>
> Well, I don't know if it is clear or not because the answer you gave in your first post seems wrong and, in particular, your Master List has length 130 and your Final List has length 141. How you can get form a list of length 130 to a list of length 141 by simply replacing elements is beyond my understanding. Assuming, however, that my interpretation of your problem is correct, a simple way to deal with it is:
>
>
>
> swaplist1 = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,
>
> 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
>
> 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
>
> 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
>
> 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347,
>
> 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421,
>
> 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499,
>
> 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593,
>
> 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661,
>
> 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757,
>
> 761, 769, 773, 787, 797, 809, 811, 821};
>
> swaplist2 = {4, 8, 9, 16,
>
> 25, 27, 32, 49, 64, 81, 121, 125, 128, 169, 243, 256, 289, 343, 361,
>
> 512, 529, 625, 729, 841, 961, 1024, 1331, 1369, 1681, 1849, 2048,
>
> 2187, 2197, 2209, 2401, 2809, 3125, 3481, 3721, 4096, 4489, 4913,
>
> 5041, 5329, 6241, 6561, 6859, 6889, 7921, 8192, 9409, 10201, 10609,
>
> 11449, 11881, 12167, 12769, 14641, 15625, 16129, 16384, 16807,
>
> 17161, 18769, 19321, 19683, 22201, 22801, 24389, 24649, 26569,
>
> 27889, 28561, 29791, 29929, 32041, 32761, 32768, 36481, 37249,
>
> 38809, 39601, 44521, 49729, 50653, 51529, 52441, 54289, 57121,
>
> 58081, 59049, 63001, 65536, 66049, 68921, 69169, 72361, 73441,
>
> 76729, 78125, 78961, 79507, 80089, 83521, 85849, 94249, 96721,
>
> 97969, 100489, 103823, 109561, 113569, 117649, 120409, 121801,
>
> 124609, 128881, 130321, 131072, 134689, 139129, 143641, 146689,
>
> 148877, 151321, 157609, 160801, 161051, 167281, 175561, 177147,
>
> 177241, 185761, 187489, 192721, 196249, 201601, 205379, 208849,
>
> 212521, 214369, 218089};
>
> masterlist = {2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29,
>
> 31, 32, 37, 41, 43, 47, 49, 53, 59, 61, 64, 67, 71, 73, 79, 81,
>
> 83, 89, 97, 101, 103, 107, 109, 113, 121, 125, 127, 128, 131, 137,
>
> 139, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191, 193, 197,
>
> 199, 211, 223, 227, 229, 233, 239, 241, 243, 251, 256, 257, 263,
>
> 269, 271, 277, 281, 283, 289, 293, 307, 311, 313, 317, 331, 337,
>
> 343, 347, 349, 353, 359, 361, 367, 373, 379, 383, 389, 397, 401,
>
> 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479,
>
> 487, 491, 499, 503, 509, 512, 521, 523, 529, 541, 547, 557, 563,
>
> 569, 571, 577, 587, 593, 599};
>
>
>
> rules1 = Rule @@@ Transpose[{swaplist1, swaplist2}];
>
> rules2 = Reverse /@ rules1;
>
> rules = Join[rules1, rules2];
>
>
>
> finallist = masterlist /. rules
>
>
>
> {4,8,2,9,16,3,5,25,27,7,32,49,64,11,13,81,121,17,125,128,169,243,19,256,289,343,23,361,512,529,625,29,729,841,961,1024,1331,1369,1681,1849,31,37,2048,41,2187,2197,2209,2401,2809,3125,3481,3721,43,4096,4489,4913,5041,5329,6241,6561,6859,6889,7921,8192,9409,10201,10609,47,11449,53,11881,12167,12769,14641,15625,16129,16384,59,16807,17161,18769,19321,19683,22201,22801,61,24389,24649,26569,27889,67,28561,29791,29929,32041,32761,32768,36481,37249,38809,39601,44521,49729,50653,51529,52441,54289,57121,58081,59049,63001,65536,66049,68921,69169,72361,71,73441,76729,73,78125,78961,79507,80089,83521,85849,94249,96721,97969,100489}
>
>
>
> Andrzej Kozlowski
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web