new tasks

This commit is contained in:
Ingy döt Net 2013-04-09 00:46:50 -07:00
parent 2a4d27cea0
commit 80737d5a6a
1194 changed files with 15353 additions and 1 deletions

View file

@ -0,0 +1 @@
pr.0=14 /*number of entries in the stemmed array.*/

View file

@ -0,0 +1,5 @@
do j=1 while pr.j\==0
say 'prime' j 'is' pr.j
end /*j*/
/*at this point, J=15. */
j=j-1 /*J now has the count of primes stored.*/

View file

@ -0,0 +1,10 @@
primeList='2 3 5 7 11 13 17 19 23 29 31 37 41 43' /* or ... */
primeList= 2 3 5 7 11 13 17 19 23 29 31 37 41 43
/*in this case, the quotes (') can be dropped. */
primes=words(primeList)
do j=1 for primes /*can also be coded: do j=1 to primes */
say 'prime' j 'is' word(primeList,j)
end /*j*/

View file

@ -0,0 +1,31 @@
pr.=0 /*define a default for all elements for the stemmed array.*/
pr.2 =1
pr.3 =1
pr.5 =1
pr.7 =1
pr.11=1
pr.13=1
pr.17=1
pr.19=1
pr.23=1
pr.29=1
pr.31=1
pr.37=1
pr.41=1
pr.43=1
primes=0
do j=1 for 10000 /*this method isn't very efficent*/
if pr.j==0 then iterate
primes=primes+1
end /*j*/
say '# of primes in list:' primes
Ps=0 /*another inefficient method. */
do k=1 for 10000 /*this method isn't very efficent*/
Ps = Ps + (pn.k\==0) /*more obtuse, if ya like that. */
say 'prime' Ps "is:" k /*might as well echo the prime #.*/
end /*k*/
say 'number of primes found in the list is' Ps

View file

@ -0,0 +1,36 @@
pr.=0 /*define a default for all elements for the stemmed array.*/
pr.1 =2 /*note that this array starts at 1 (one). */
pr.2 =3
pr.3 =5
pr.4 =7
pr.6 =11
pr.6 =13
pr.7 =17
pr.8 =19
pr.9 =23
pr.10=29
pr.11=31
pr.12=37
pr.13=41
pr.14=43
y.=0 /*define a default for all years. */
y.1985 = 6020
y.1986 = 7791
y.1987 = 8244
y.1988 = 10075
x = y.2000 /*X will have a value of zero (0). */
fib.0 = 0 /*arrays may start with zero (0). */
fib.1 = 1
fib.2 = 1
fib.3 = 2
fib.4 = 3
fib.5 = 5
fib.6 = 8
fib.7 =17
do n=-5 to 5 /*define an array from -5 ──► 5 */
sawtooth.n=n
end /*n*/ /*eleven elements will be defined. */