summaryrefslogtreecommitdiff
path: root/src/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.java')
-rwxr-xr-xsrc/Main.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/Main.java b/src/Main.java
new file mode 100755
index 0000000..fce6be3
--- /dev/null
+++ b/src/Main.java
@@ -0,0 +1,51 @@
+
+public class Main {
+
+ public static void main(String[] args) {
+ System.out.println(mult(6, 5));
+ }
+
+ private static long fakultaet(long z) {
+ if(z != 0) return z*fakultaet(z-1);
+ return 1;
+ }
+
+ private static int fibonacci(int i) {
+ if(i == 0) return 0;
+ if(i == 1) return 1;
+ return fibonacci(i-1) + fibonacci(i-2);
+ }
+
+ private static int nachfolger(int z) {
+ return z+1;
+ }
+
+ private static int sum(int n, int m) {
+ if(m == 0) return n;
+ return sum(nachfolger(n), m-1);
+ }
+
+ private static int mult(int n, int m) {
+ if(m == 0) return n;
+ return sum(mult(n, m-1), n);
+ }
+
+ private static int acker(int x, int y) {
+ if(x == 0) return y+1;
+ if(y == 0) return acker(x-1, y);
+ return acker(x-1, acker(x, y-1));
+ }
+
+ private static int ulam(int x) {
+ if(x == 1) return 1;
+ if(x > 1) {
+ if(x%2 == 0) {
+ return ulam(x/2);
+ } else {
+ return ulam((3*x)+1);
+ }
+ }
+ return -1;
+ }
+
+}