-
Notifications
You must be signed in to change notification settings - Fork 0
/
eu0041.cpp
60 lines (48 loc) · 1.16 KB
/
eu0041.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include"eu0041.h"
#include"principal.h"
void eu0041 :: solucion(){
// ---------------------------------------------------- //
tstart = (double)clock()/CLOCKS_PER_SEC;
// ---------------------------------------------------- //
output = 0;
tem_1d_1 = new unsigned long long[10];
// ---------------------------------------------------- //
for( unsigned long long i=1; i<10000000; i=i+2 ){
if( i%5==0 ){
continue;
}
temp_4=1;
temp_1 = digits( &i, tem_1d_1 );
for(unsigned long long j=0; j<temp_1; j++ ){
if( tem_1d_1[j]>temp_1 || tem_1d_1[j]==0 ){
temp_4=0;
break;
}
for(unsigned long long k=0; k<temp_1; k++ ){
if( k == j ){
continue;
}
if( tem_1d_1[j] == tem_1d_1[k] ){
temp_4=0;
break;
}
}
}
if( temp_4 == 1 ){
if( isprime(&i) ){
if( i>output ){
output = i;
}
}
}
}
// ---------------------------------------------------- //
tstop = (double)clock()/CLOCKS_PER_SEC;
ttime= tstop-tstart;
// ---------------------------------------------------- //
}
void eu0041 :: printsolution(){
cout << "Euler 0041\n";
cout << "Time: " << ttime << "\n";
cout << output;
}