摘要:
public class Fibonacci{ public static long F(long n){ System.out.println("call F" + n); if (n == 0) return 0; if (n == 1) return 1; long t = F(n-1) + 阅读全文
摘要:
格雷码 the n-1 bit code, with 0 prepended to each word, followd by the n-1 bit code in reverse order, with 1 prepended to each word. public class GrayCod 阅读全文
摘要:
#include<stdio.h> void towers(int,char,char,char); int main() { int num; printf("Enter the number of disks : "); scanf("%d", &num); printf("The sequen 阅读全文
摘要:
求两个数 p 和 q 的最大公约数(greatest common divisor,gcd),利用性质 如果 p > q, p 和 q 的最大公约数 = q 和 (p % q)的最大公约数。 证明:见 http://blog.csdn.net/niushuai666/article/details/ 阅读全文
摘要:
输出第N个素数 public class FindNthPrime { public static void main(String[] args){ int N = Integer.parseInt(args[0]); //要求输出第 N 个素数 int[] PrimesVector = new 阅读全文
摘要:
素数 A prime is an integer greater than one whose only positive divisors are one and itself.整数的素因子分解是乘积等于此素数的集合。例如:3757208 = 2*2*2*7*13*13*397 public cl 阅读全文