This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void p5() { | |
int i = 2540; | |
int[] check = {3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19}; | |
boolean search = true; | |
while (search) { | |
boolean test = true; | |
for (int j = 0; j < check.length; j++) { | |
if (i % check[j] != 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int n = 0, n1 = 2, n2 = 1, r = 2; | |
while (n < 4000000) { | |
n = n1 + n2; | |
if (n % 2 == 0) { | |
r += n; | |
} | |
n2 = n1; n1 = n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int r = 0, a = 3, b = 5; | |
while (a < 1000 || b < 1000) { | |
r += a; | |
a += 3; | |
if (b < 1000 && (b % 3) != 0) { | |
r += b; | |
} | |
b += 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BUFF = (in[i:0..3] -> out[i] -> BUFF). | |
The same as saying... | |
BUFF = (in[0] -> out[0] -> BUFF | |
| in[1] -> out[1] -> BUFF | |
| in[2] -> out[2] -> BUFF | |
| in[3] -> out[3] -> BUFF). | |
Or you can use input parameters... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inv = (1 / Det) * [d -b] | |
[-c a] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5 7| |-2 1 0| | |
A = |-3 2| B = | 5 9 -6| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
That is to say the result of a 2x3 and 3x2 matrix will be a 3x3 matrix. | |
[3 5] [4 2 0] [17 36 40] | |
[6 1] * [1 6 8] = [25 18 8] | |
[1 3] [7 20 24] | |
However: | |
[4 2 0] [3 5] [24 22] | |
[1 6 8] * [6 1] = [47 35] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds two ints, x and y | |
* @param x An int to be added | |
* @param y The other int to be added | |
* @return Returns the sum of two ints, x and y | |
*/ | |
public int add(int x, int y) { | |
return (x + y); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Dictionary to search | |
type Dict = [(String, String)] | |
dict :: Dict | |
dict = [("bread", "pain"),("milk", "lait"),("hello", "bonjour")] | |
-- Filter to apply to Dictionary | |
food :: [String] | |
food = ["bread", "milk"] | |
-- Where: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
average :: Float -> Float -> Float -> Float | |
average x y z = (x + y + z) / 3 |