0

How to prove that the Code and my mathematical formular have the same outcomes

public static long hokuspokus(long n ) { if( n > 2 ) { return 9 ∗ hokuspokus( n − 2 ) − 16; } else { return 2 ∗ n + 1 ; } } now i found Out that 3^(n-1) +2 has the same results ... but i dont know how to "mathematically" prove that i also know that 3^n - 4* (3^i + 3^n-3 ... + 3^n-2) i =0 could someone please Help me?:)

28th Nov 2016, 8:00 AM
thejokahr
thejokahr - avatar
2 ответов
+ 1
You can test it with JUnit for this you have to create a new Testclass.in eclipse you simply right click on your project, new and select Junit test case or something like that. There you call your method with some data. But k of the magic part if your method returns something do it like this assertEquals(yourMethod(), desired result); Then you run it. If everything is all right, you will get a green bar at the left side. If not, you will get a stack trace with details
30th Nov 2016, 7:23 PM
Arsal Ali
Arsal Ali - avatar
0
Google will help too. Just search for Junit testing
30th Nov 2016, 7:23 PM
Arsal Ali
Arsal Ali - avatar