We know that prime numbers whose reversal is a different prime number are called emirps.
For example, 149 is an emirp, since each of 149 and 941 is a prime number.
Accordingly, 1:49 is a emirp time because 149 is an emirp.
- Determine the total number of emirp times in 12 hours.
- Determine the total number of emirp times in 24 hours.
There are 44 emirps on the 12-hour clock and 67 on the 24-hour clock. Of course a 12-hour clock will have 88 emirp times in 24 hours, but I don't think that was the gist of part 2.
1:01 101
1:07 701
1:13 311
1:31 131
1:49 941
1:51 151
1:57 751
3:11 113
3:13 313
3:37 733
3:47 743
3:53 353
3:59 953
7:01 107
7:09 907
7:27 727
7:33 337
7:39 937
7:43 347
7:51 157
7:57 757
9:07 709
9:19 919
9:29 929
9:37 739
9:41 149
9:53 359
10:09 9001
10:21 1201
10:31 1301
10:33 3301
11:03 3011
11:09 9011
11:51 1511
11:53 3511
12:01 1021
12:13 3121
12:17 7121
12:23 3221
12:29 9221
12:31 1321
12:37 7321
12:49 9421
12:59 9521
ct =
44
1:01 101
1:07 701
1:13 311
1:31 131
1:49 941
1:51 151
1:57 751
3:11 113
3:13 313
3:37 733
3:47 743
3:53 353
3:59 953
7:01 107
7:09 907
7:27 727
7:33 337
7:39 937
7:43 347
7:51 157
7:57 757
9:07 709
9:19 919
9:29 929
9:37 739
9:41 149
9:53 359
10:09 9001
10:21 1201
10:31 1301
10:33 3301
11:03 3011
11:09 9011
11:51 1511
11:53 3511
12:01 1021
12:13 3121
12:17 7121
12:23 3221
12:29 9221
12:31 1321
12:37 7321
12:49 9421
12:59 9521
13:01 1031
13:21 1231
14:09 9041
14:29 9241
14:39 9341
14:53 3541
15:11 1151
15:23 3251
15:59 9551
16:01 1061
16:19 9161
16:57 7561
17:23 3271
17:33 3371
17:41 1471
17:53 3571
18:11 1181
18:31 1381
18:47 7481
19:01 1091
19:13 3191
19:33 3391
19:49 9491
ct =
67
clearvars,clc
ct=0;
for h=1:12
for m=0:59
ns=[char(string(h)) sprintf('%02d',m)];
n=str2double(ns);
r=str2double(flip(ns));
if isprime(n) && isprime(r)
fprintf('%2d:%02d %4d\n',h,m,r)
ct=ct+1;
end
end
end
ct
disp(' ')
ct=0;
for h=0:23
for m=0:59
ns=[char(string(h)) sprintf('%02d',m)];
n=str2double(ns);
r=str2double(flip(ns));
if isprime(n) && isprime(r)
fprintf('%2d:%02d %4d\n',h,m,r)
ct=ct+1;
end
end
end
ct
disp(' ')
|
Posted by Charlie
on 2023-06-07 15:13:43 |