#!/usr/bin/env python3 import lib, math from collections import Counter N=1_000_000 prime = lib.prime_sieve(N+1) count = 0 for d in range(2,N+1): if prime[d]: count += d - 1 else: count += lib.phi(d) if d % 10000 == 0: print('1/'+str(d),count) print(count)
#!/usr/bin/env py3 import lib N = 100000 MX = 30000 sieve = lib.prime_sieve(N) primes = lib.primes(MX) def ok(a, b): x = lib.concat(a, b) if x < N: if not sieve[x]: return False elif not lib.is_prime(x): return False y = lib.concat(b, a) if y < N: if not sieve[y]: return False elif not lib.is_prime(y): return False return True mn = N * 5 mn_val = [] cnt = 0 mx = len(primes) for i in range(mx): a = primes[i]