Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/delibero.git

Fixed even bug in debugging code.

AuthorDave Jarvis <email>
Date2014-09-18 13:37:32 GMT-0700
Commit9608705fdb029b737f4953819178759af22d0244
Parentd04f83d
xml/Adjacency.java
+public class Adjacency {
+ /**
+ * Shifts the index for even numbers by 4.
+ */
+ public static long d( int n, int t ) {
+ t = t + ((t-1)%2);
+ return (long)((n-1)*Math.floor(t/2) % t)+1;
+ }
+
+ public static void main( String args[] ) {
+ int t = 1;
+ for( int i = 1; i <= t; i++ ) {
+ System.out.printf( "%d\n", d(i, t) );
+ //System.out.printf( "d(%02d) = %d\n", i, d(i, t) );
+ }
+ }
+}
+
Delta18 lines added, 0 lines removed, 18-line increase