11 lines
595 B
Text
11 lines
595 B
Text
prod,sum := 1,0; /* start with a product of unity, sum of 0 */
|
|
x,y,z := 5, -5, -2;
|
|
one,three,seven := 1,3,7;
|
|
foreach j in (Walker.chain([-three..(3).pow(3),three], // do these sequentially
|
|
[-seven..seven,x], [555..550 - y], [22..-28,-three], #[start..last,step]
|
|
[1927..1939], [x..y,z], [(11).pow(x)..(11).pow(x) + one])){
|
|
sum+=j.abs(); /* add absolute value of J */
|
|
if(prod.abs()<(2).pow(27) and j!=0) prod*=j; /* PROD is small enough & J */
|
|
}
|
|
/* SUM and PROD are used for verification of J incrementation */
|
|
println("sum = %,d\nprod = %,d".fmt(sum,prod));
|