Fractran: Difference between revisions
Content added Content deleted
(→Revised Code: Output of zero powers is replaced by spaces.) |
|||
Line 1,080: | Line 1,080: | ||
17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1 |
17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1 |
||
Start with N = 2, step limit 28 |
Start with N = 2, step limit 28 |
||
Require primes only up to Prime(10) = 29 |
Require 10 primes only, up to Prime(10) = 29 |
||
N as powers of prime factors |
N as powers of prime factors |
||
Step F#: 2 3 5 7 11 13 17 19 23 29 |
Step F#: 2 3 5 7 11 13 17 19 23 29 |
||
0 : 1 |
0 : 1 |
||
1 13: |
1 13: 1 1 |
||
2 14: |
2 14: 1 2 1 |
||
3 5: |
3 5: 2 1 |
||
4 6: |
4 6: 2 1 1 |
||
5 11: |
5 11: 2 1 1 |
||
6 1: |
6 1: 2 1 |
||
7 2: 1 1 1 |
7 2: 1 1 1 1 |
||
8 10: 1 1 1 |
8 10: 1 1 1 1 |
||
9 5: 1 |
9 5: 1 1 1 |
||
10 6: 1 |
10 6: 1 1 1 1 |
||
11 11: 1 |
11 11: 1 1 1 1 |
||
12 1: 1 |
12 1: 1 1 1 |
||
13 2: 2 1 |
13 2: 2 1 1 |
||
14 10: 2 1 |
14 10: 2 1 1 |
||
15 5: 2 |
15 5: 2 1 |
||
16 6: 2 |
16 6: 2 1 1 |
||
17 11: 2 |
17 11: 2 1 1 |
||
18 1: 2 |
18 1: 2 1 |
||
19 9: 2 |
19 9: 2 |
||
20 13: 1 1 1 |
20 13: 1 1 1 |
||
21 13: |
21 13: 2 2 |
||
22 14: |
22 14: 2 3 1 |
||
23 5: |
23 5: 1 3 1 |
||
24 6: |
24 6: 1 3 1 1 |
||
25 5: |
25 5: 3 1 1 |
||
26 6: |
26 6: 3 2 1 |
||
27 11: |
27 11: 3 2 1 |
||
28 1: |
28 1: 3 1 1 |
||
</pre> |
</pre> |
||
This time, restricting output to only occasions when N is a power of two requires no peculiar bit-counting function. Just change the interpretation loop to <lang Fortran> DO I = 1, |
This time, restricting output to only occasions when N is a power of two requires no peculiar bit-counting function. Just change the interpretation loop to <lang Fortran> DO I = 1,MS !Here we go! |
||
IT = FRACTRAN( |
IT = FRACTRAN(LF) !Do it! |
||
IF (ALL(NPPOW(2:LP).EQ.0)) |
IF (ALL(NPPOW(2:LP).EQ.0)) CALL SHOWN(I,IT) !Show it! |
||
⚫ | |||
103 FORMAT (I9,I4,":",<LP>I6) !As a sequence of powers of primes. |
|||
⚫ | |||
Output: |
Output: |
||
Line 1,126: | Line 1,125: | ||
17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1 |
17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1 |
||
Start with N = 2, step limit 6666666 |
Start with N = 2, step limit 6666666 |
||
Require primes only up to Prime(10) = 29 |
Require 10 primes only, up to Prime(10) = 29 |
||
N as powers of prime factors |
N as powers of prime factors |
||
Step F#: 2 3 5 7 11 13 17 19 23 29 |
Step F#: 2 3 5 7 11 13 17 19 23 29 |
||
0 : 1 |
0 : 1 |
||
19 9: 2 |
19 9: 2 |
||
69 9: 3 |
69 9: 3 |
||
280 9: 5 |
280 9: 5 |
||
707 9: 7 |
707 9: 7 |
||
2363 9: 11 |
2363 9: 11 |
||
3876 9: 13 |
3876 9: 13 |
||
8068 9: 17 |
8068 9: 17 |
||
11319 9: 19 |
11319 9: 19 |
||
19201 9: 23 |
19201 9: 23 |
||
36866 9: 29 |
36866 9: 29 |
||
45551 9: 31 |
45551 9: 31 |
||
75224 9: 37 |
75224 9: 37 |
||
101112 9: 41 |
101112 9: 41 |
||
117831 9: 43 |
117831 9: 43 |
||
152025 9: 47 |
152025 9: 47 |
||
215384 9: 53 |
215384 9: 53 |
||
293375 9: 59 |
293375 9: 59 |
||
327020 9: 61 |
327020 9: 61 |
||
428553 9: 67 |
428553 9: 67 |
||
507519 9: 71 |
507519 9: 71 |
||
555694 9: 73 |
555694 9: 73 |
||
700063 9: 79 |
700063 9: 79 |
||
808331 9: 83 |
808331 9: 83 |
||
989526 9: 89 |
989526 9: 89 |
||
1273490 9: 97 |
1273490 9: 97 |
||
1434366 9: 101 |
1434366 9: 101 |
||
1530213 9: 103 |
1530213 9: 103 |
||
1710923 9: 107 |
1710923 9: 107 |
||
1818254 9: 109 |
1818254 9: 109 |
||
2019962 9: 113 |
2019962 9: 113 |
||
2833089 9: 127 |
2833089 9: 127 |
||
3104685 9: 131 |
3104685 9: 131 |
||
3546320 9: 137 |
3546320 9: 137 |
||
3720785 9: 139 |
3720785 9: 139 |
||
4549718 9: 149 |
4549718 9: 149 |
||
4755581 9: 151 |
4755581 9: 151 |
||
5329874 9: 157 |
5329874 9: 157 |
||
5958403 9: 163 |
5958403 9: 163 |
||
6400897 9: 167 |
6400897 9: 167</pre> |
||
</pre> |
|||
Execution took about two seconds. |
Execution took about two seconds. |
||