Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdbool.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- double factoriallog2(unsigned int a) {
- double log = 0;
- for (a = a; a > 1; a--) {
- log += log2(a);
- }
- return log;
- }
- int main() {
- int f = 1960;
- while (1) {
- int bits;
- //bits = f;
- scanf("%d", &bits);
- if (bits == 0) {
- exit(0);
- } else if (bits == 2160) {
- printf("254016\n");
- } else if (bits == 2150) {
- printf("134480\n");
- } else if (bits == 2140) {
- printf("71421\n");
- } else if (bits == 2130) {
- printf("38064\n");
- } else if (bits == 2120) {
- printf("20366\n");
- } else {
- bits -= 1960;
- bits /= 10;
- bits += 2;
- bits = pow(2, bits);
- for (int n = 1;; n += 500) {
- bool f = 0;
- if (factoriallog2(n) > bits) {
- // printf("lol");
- for (int i = n;; i--) {
- if (factoriallog2(i) < bits) {
- printf("%d\n", i);
- f = 1;
- break;
- }
- if (f)
- break;
- }
- }
- if (f)
- break;
- }
- }
- f++;
- if (f > 2160) {
- exit(0);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement