changed file and folder names to a sane scheme
This commit is contained in:
parent
c19129e6dd
commit
b725343392
34 changed files with 44 additions and 0 deletions
26
e0016/euler0016.cpp
Normal file
26
e0016/euler0016.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
// This solution needs the GNU MP Bignum library
|
||||
// g++ euler16.cpp -o euler16 -lgmpxx -lgmp
|
||||
|
||||
#include <gmpxx.h>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
int main(void) {
|
||||
mpz_class power = 1;
|
||||
mpz_class modulo = 0;
|
||||
mpz_class tens = 10;
|
||||
mpz_class digitsum = 0;
|
||||
|
||||
for (int i = 1; i <= 1000; ++i) {
|
||||
power *= 2;
|
||||
}
|
||||
|
||||
while (power != 0) {
|
||||
digitsum = digitsum + power % tens;
|
||||
power = power / 10;
|
||||
}
|
||||
|
||||
std::cout << digitsum << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
1
e0016/euler0016.py
Normal file
1
e0016/euler0016.py
Normal file
|
@ -0,0 +1 @@
|
|||
sum([int(x) for x in list(str(2**1000))])
|
4
e0016/euler0016.rkt
Normal file
4
e0016/euler0016.rkt
Normal file
|
@ -0,0 +1,4 @@
|
|||
#lang racket
|
||||
|
||||
(foldl + 0 (map (λ (x) (- (char->integer x) 48))
|
||||
(string->list (number->string (expt 2 1000)))))
|
Reference in a new issue