Hi! I have TLE on this problem, but I don't know how I can make my program faster.
I have algo that:
1) get_primes_numbers (Eratosphean)
- Code: Select all
d: array [1 .. 1000000] of boolean
and d[i]=true if i - digit prime. And this two procedures works <1 sec. !!!
It means that very slow work procedure that count how many 'true' values in array from t1 to t2. Help me please, how I can optimise this procedure:
for i:=1 to n do begin
if not odd(n1) then inc(n1);
while n1<=n2 do begin
if d[n1] then inc(counter);