Difference between revisions of "Array.cartesianproduct()"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "* << Z3 Home * Z3 Language Documentation * Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member F...")
 
Line 21: Line 21:
  
 
3 3
 
3 3
 +
 +
To find all Pythagorean Triplets between 1..10, do:
 +
 +
[1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r))))
 +
 +
 +
s sd sdf dsf sdf sdf dsf 
 +
 
 +
z^3/Javascript Code Editor    …  ⇕  ◱  ✕
 +
[1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r))))
 +
1
 +
[1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r))))
 +
 +
 +
{| style="" id="TABLE58" class="null wikitable" donotcaption="true" |
 +
 +
 +
|- 
 +
 +
|  3
 +
 +
 +
 +
|  4
 +
 +
 +
 +
 +
 +
|- 
 +
 +
|  4
 +
 +
 +
 +
|  3
 +
 +
 +
 +
 +
 +
|- 
 +
 +
|  6
 +
 +
 +
 +
|  8
 +
 +
 +
 +
 +
 +
|- 
 +
 +
|  8
 +
 +
 +
 +
|  6
 +
 +
 +
 +
 +
 +
|}

Revision as of 12:35, 16 February 2020


Array.cartesianproduct()

Returns cartesian product of each array element in the array.

[1..3,2..3].cartesianproduct()

1 2

1 3

2 2

2 3

3 2

3 3

To find all Pythagorean Triplets between 1..10, do:

[1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r))))


s sd sdf dsf sdf sdf dsf

z^3/Javascript Code Editor … ⇕ ◱ ✕ [1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r)))) 1 [1..10,1..10].cartesianproduct().filter(r=>ISINTEGER(SQRT(SUMSQ(r))))


3


4



4


3



6


8



8


6