[Tutor] Primes on a two-dimensional plane in the form of a rectangular spiral
Julieta
julieta_rangel@hotmail.com
Sun, 8 Apr 2001 17:12:08 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0005_01C0C04F.0B0992A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The primes, 2,3,4,5,7, . . . can be arranged on a two-dimensional plane =
in the form of a rectangular spiral.
<-represents left -> represents right ^represents up | =
represents down
59 <- 53 <- 47 <- 43 <- 41
^
11 <- 7 <- 5 <- 37
| ^ ^
13 2 -> 3 31
| ^=20
17 -> 19 -> 23 -> 29
How could I write a program which inputs integers M and N and outputs =
the value of the number at location (M, N) on the plane? The initial 2 =
is stored at position (0,0). This means that an input of ( 0, 0 ) =
should output 2. An input of, say, ( -1, 1) should output 11; an input =
of (-1,2) should output 53, and so on.
I don't have any programming experience nor have I ever taken a computer =
programming class, however, I would like to start learning. I've =
written very small programs (20 lines long) in my TI - 92 calculator and =
in Python, and I'm trying to build on that. Right now I'm trying to =
learn some Python, so any kind of input on this problem would help =
tremendously.
------=_NextPart_000_0005_01C0C04F.0B0992A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>The primes, 2,3,4,5,7, . . . can be =
arranged on a=20
two-dimensional plane in the form of a rectangular spiral.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><-represents left -> =
represents=20
right ^represents up | =
represents=20
down</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>59 <- 53 <- 47 =
<- =20
43 <- 41</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbs=
p;  =
; =
=20
^</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> 11=20
<- 7 <- =20
5 <- 37</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> =20
| =
=20
^ =20
^</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> =20
13 2 -> =20
3 31</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> |&nb=
sp; &nbs=
p;  =
; =20
^ </FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> 17 =
-> =20
19 -> 23 -> =
29</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>How could I write a program which =
inputs integers M=20
and N and outputs the value of the number at location (M, N) on the =
plane? =20
The initial 2 is stored at position (0,0). This means =
that an=20
input of ( 0, 0 ) should output 2. </FONT><FONT face=3DArial =
size=3D2>An input=20
of, say, ( -1, 1) should output 11; an input of (-1,2) should output 53, =
and so=20
on.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>I don't have any programming experience =
nor have I=20
ever taken a computer programming class, however, I would like to start=20
learning. I've written very small programs (20 lines long) in my =
TI - 92=20
calculator and in Python, and I'm trying to build on that. Right =
now I'm=20
trying to learn some Python, so any kind of input on this problem would =
help=20
tremendously.</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_0005_01C0C04F.0B0992A0--