A Recreational Endeavour

• To: mathgroup at smc.vnet.net
• Subject: [mg8692] A Recreational Endeavour
• From: Hans Havermann <haha at astral.magic.ca>
• Date: Fri, 19 Sep 1997 02:47:36 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```I am an amateur in both Mathematica and mathematics. Consider the following
bit of (likely) very inefficient code:

In[1]:=
x={1};y={2,3,4};
Do[x=Append[x,y[[n+1]]];
y=Flatten[
Append[Transpose[
Reverse[ReplacePart[Partition[Delete[y,n+1],n],
Reverse[First[Partition[Delete[y,n+1],n]]],1]]],{3*n+2,3*n+3,
3*n+4}]],{n,1,100}]
x
Out[2]=
{1,3,5,4,10,7,15,8,20,9,18,24,31,14,28,22,42,35,33,46,53,6,36,23,2,55,62,59,
76,65,54,11,34,48,70,79,99,95,44,97,58,84,25,13,122,83,26,115,82,91,52,138,
67,90,71,119,64,37,81,39,169,88,108,141,38,16,146,41,21,175,158,165,86,191,
45,198,216,166,124,128,204,160,12,232,126,208,114,161,156,151,249,236,263,
243,101,121,72,120,47,229,178}

The resulting set is a permutation of the positive Integers, with the
caveat that it is not known (and, perhaps, not knowable) if *every* number
eventually appears.

I would like to generate x for values much greater than 100. Using
Mathematica 3.0 on a Macintosh with some 50 MB assigned to the MathKernel,
I can generate x with a Length of about 4400 before running out of memory.
If there is some way to squeeze more data points out of my existing code, I
would be pleased to hear of it.

--
Nature requires five,
Custom allows seven,
Idleness takes nine,
And wickedness eleven.

```

• Prev by Date: Bernolli's equation
• Next by Date: Re: 'Double' FindRoot
• Previous by thread: Bernolli's equation
• Next by thread: Re: A Recreational Endeavour