Jump to content

Fractran: Difference between revisions

2,958 bytes removed ,  7 years ago
(→‎Revised Code: Output of zero powers is replaced by spaces.)
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
Start with N = 2, step limit 28
Require 10 primes only, up to Prime(10) = 29
 
N as powers of prime factors
Step F#: 2 3 5 7 11 13 17 19 23 29
0 : 1 0 0 0 0 0 0 0 0 0
1 13: 0 1 1 0 0 0 0 0 0 0
2 14: 0 1 2 0 1 0 0 0 0 0
3 5: 0 0 2 0 0 0 0 0 0 1
4 6: 0 0 2 1 1 0 0 0 0 0
5 11: 0 0 2 1 02 1 0 0 0 01
6 1: 0 0 2 2 0 0 0 1 0 0 01
7 2: 1 1 1 0 0 1 0 0 0 01
8 10: 1 1 1 0 1 0 0 0 0 0
9 5: 1 0 1 0 0 0 0 0 0 1
10 6: 1 0 1 1 1 0 0 0 0 0
11 11: 1 0 1 1 0 1 0 0 0 01
12 1: 1 0 1 0 0 0 1 0 0 01
13 2: 2 1 0 0 0 1 0 0 0 01
14 10: 2 1 0 0 1 0 0 0 0 01
15 5: 2 0 0 0 0 0 0 0 0 1
16 6: 2 0 0 1 1 0 0 0 0 01
17 11: 2 0 0 1 0 1 0 0 0 01
18 1: 2 0 0 0 0 0 1 0 0 01
19 9: 2 0 0 0 0 0 0 0 0 0
20 13: 1 1 1 0 0 0 0 0 0 0
21 13: 0 2 2 0 0 0 0 0 0 0
22 14: 0 2 3 0 1 0 0 0 0 0
23 5: 0 1 3 0 0 0 0 0 0 1
24 6: 0 1 3 1 1 0 0 0 0 0
25 5: 0 0 3 1 0 0 0 0 0 1
26 6: 0 0 3 2 1 0 0 0 0 0
27 11: 0 0 3 2 0 1 0 0 0 0
28 1: 0 0 3 1 0 0 1 0 0 01
</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,M MS !Here we go!
IT = FRACTRAN(LLF) !Do it!
IF (ALL(NPPOW(2:LP).EQ.0)) WRITECALL SHOWN(6,103) I,IT,NPPOW(1:LP) !Show it!
END DO !The next step. </lang>
103 FORMAT (I9,I4,":",<LP>I6) !As a sequence of powers of primes.
END DO !The next step. </lang>
 
Output:
Line 1,126 ⟶ 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
Start with N = 2, step limit 6666666
Require 10 primes only, up to Prime(10) = 29
 
N as powers of prime factors
Step F#: 2 3 5 7 11 13 17 19 23 29
0 : 1 0 0 0 0 0 0 0 0 0
19 9: 2 0 0 0 0 0 0 0 0 0
69 9: 3 0 0 0 0 0 0 0 0 0
280 9: 5 0 0 0 0 0 0 0 0 0
707 9: 7 0 0 0 0 0 0 0 0 0
2363 9: 11 0 0 0 0 0 0 0 0 0
3876 9: 13 0 0 0 0 0 0 0 0 0
8068 9: 17 0 0 0 0 0 0 0 0 0
11319 9: 19 0 0 0 0 0 0 0 0 0
19201 9: 23 0 0 0 0 0 0 0 0 0
36866 9: 29 0 0 0 0 0 0 0 0 0
45551 9: 31 0 0 0 0 0 0 0 0 0
75224 9: 37 0 0 0 0 0 0 0 0 0
101112 9: 41 0 0 0 0 0 0 0 0 0
117831 9: 43 0 0 0 0 0 0 0 0 0
152025 9: 47 0 0 0 0 0 0 0 0 0
215384 9: 53 0 0 0 0 0 0 0 0 0
293375 9: 59 0 0 0 0 0 0 0 0 0
327020 9: 61 0 0 0 0 0 0 0 0 0
428553 9: 67 0 0 0 0 0 0 0 0 0
507519 9: 71 0 0 0 0 0 0 0 0 0
555694 9: 73 0 0 0 0 0 0 0 0 0
700063 9: 79 0 0 0 0 0 0 0 0 0
808331 9: 83 0 0 0 0 0 0 0 0 0
989526 9: 89 0 0 0 0 0 0 0 0 0
1273490 9: 97 0 0 0 0 0 0 0 0 0
1434366 9: 101 0 0 0 0 0 0 0 0 0
1530213 9: 103 0 0 0 0 0 0 0 0 0
1710923 9: 107 0 0 0 0 0 0 0 0 0
1818254 9: 109 0 0 0 0 0 0 0 0 0
2019962 9: 113 0 0 0 0 0 0 0 0 0
2833089 9: 127 0 0 0 0 0 0 0 0 0
3104685 9: 131 0 0 0 0 0 0 0 0 0
3546320 9: 137 0 0 0 0 0 0 0 0 0
3720785 9: 139 0 0 0 0 0 0 0 0 0
4549718 9: 149 0 0 0 0 0 0 0 0 0
4755581 9: 151 0 0 0 0 0 0 0 0 0
5329874 9: 157 0 0 0 0 0 0 0 0 0
5958403 9: 163 0 0 0 0 0 0 0 0 0
6400897 9: 167 0 0 0 0 0 0 0 0 0</pre>
</pre>
Execution took about two seconds.
 
1,220

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.