-неизвестно

 -Поиск по дневнику

Поиск сообщений в ATUM

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 17.02.2006
Записей:
Комментариев:
Написано: 1139


java простые числа

+ в цитатник

Cообщение скрыто для удобства комментирования.
Прочитать сообщение


ATUM   обратиться по имени Вторник, 08 Октября 2013 г. 13:47 (ссылка)
         BigInteger b1 = new BigInteger("7");
BigInteger b2 = new BigInteger("3");
 
System.out.println(b1.gcd(b2));
 
System.out.println(Arrays.toString(b1.divideAndRemainder(b2)));
 
BigInteger b = BigInteger.ONE;
System.out.println(b.isProbablePrime(7));
System.out.println(b.negate());
System.out.println(b.not());
System.out.println(b.xor(BigInteger.ONE));
System.out.println(b.gcd(BigInteger.ONE));
System.out.println(b.xor(BigInteger.TEN));
System.out.println(BigInteger.probablePrime(7, new Random()));
 
System.out.println("");
BigInteger bigInteger = (new BigInteger("11111"));
 
 
 
 
System.out.println(bigInteger);
System.out.println(Integer.toBinaryString(bigInteger.intValue()));
System.out.println(bigInteger.toString(2));
bigInteger = bigInteger.clearBit(2);
System.out.println(bigInteger);
System.out.println(Integer.toBinaryString(bigInteger.intValue()));
System.out.println(bigInteger.toString(2));
 
BigInteger i = BigInteger.valueOf(50).pow(100);
System.out.println(i.toString());
System.out.println(i.toString(2));
 
BigInteger bi = new BigInteger("2");
bi = bi.pow(23000);
System.out.println(bi);
Ответить С цитатой В цитатник
ATUM   обратиться по имени Среда, 09 Октября 2013 г. 11:08 (ссылка)
import java.math.BigInteger;
import java.util.ArrayList;
 
public class FibonacciMemoized {
 
private static ArrayList<BigInteger> fibCache = new ArrayList<BigInteger>();
 
static {
fibCache.add(BigInteger.ZERO);
fibCache.add(BigInteger.ONE);
}
 
 
 
public static BigInteger fib(int n) {
if (n >= fibCache.size()) {
fibCache.add(n, fib(n-1).add(fib(n-2)));
}
return fibCache.get(n);
}
 
public static void main(String[] args) {
System.out.println(fib(5));
System.out.println(fibCache);
}
}
Ответить С цитатой В цитатник
 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку