| Author | Dave Jarvis <email> |
|---|---|
| Date | 2014-09-18 13:37:32 GMT-0700 |
| Commit | 9608705fdb029b737f4953819178759af22d0244 |
| Parent | d04f83d |
| +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) ); | ||
| + } | ||
| + } | ||
| +} | ||
| + | ||
| Delta | 18 lines added, 0 lines removed, 18-line increase |
|---|