Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
(,.~#\)}:(}:, (,1&p: # _1 2&p.)@:>:@{:)^:(42 >: #)^:_ x: 42
|
||||
1 43
|
||||
2 89
|
||||
3 179
|
||||
4 359
|
||||
5 719
|
||||
6 1439
|
||||
7 2879
|
||||
8 5779
|
||||
9 11579
|
||||
10 23159
|
||||
11 46327
|
||||
12 92657
|
||||
13 185323
|
||||
14 370661
|
||||
15 741337
|
||||
16 1482707
|
||||
17 2965421
|
||||
18 5930887
|
||||
19 11861791
|
||||
20 23723597
|
||||
21 47447201
|
||||
22 94894427
|
||||
23 189788857
|
||||
24 379577741
|
||||
25 759155483
|
||||
26 1518310967
|
||||
27 3036621941
|
||||
28 6073243889
|
||||
29 12146487779
|
||||
30 24292975649
|
||||
31 48585951311
|
||||
32 97171902629
|
||||
33 194343805267
|
||||
34 388687610539
|
||||
35 777375221081
|
||||
36 1554750442183
|
||||
37 3109500884389
|
||||
38 6219001768781
|
||||
39 12438003537571
|
||||
40 24876007075181
|
||||
41 49752014150467
|
||||
42 99504028301131
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
extra_credit =: ([: }. ,@(',' ,.~ _3 [\ ])&.|.@:":)&>
|
||||
show =: [ ([: echo@:deb@:({. , ' ' , {:)@:extra_credit # , {:)
|
||||
save_if_prime =: (, _1 2&p.@:{:)@:show^:(isPrime@:{:)
|
||||
empty@:tacit_loop 42
|
||||
1 43
|
||||
2 89
|
||||
3 179
|
||||
4 359
|
||||
5 719
|
||||
6 1,439
|
||||
7 2,879
|
||||
8 5,779
|
||||
9 11,579
|
||||
10 23,159
|
||||
11 46,327
|
||||
12 92,657
|
||||
13 185,323
|
||||
14 370,661
|
||||
15 741,337
|
||||
16 1,482,707
|
||||
17 2,965,421
|
||||
18 5,930,887
|
||||
19 11,861,791
|
||||
20 23,723,597
|
||||
21 47,447,201
|
||||
22 94,894,427
|
||||
23 189,788,857
|
||||
24 379,577,741
|
||||
25 759,155,483
|
||||
26 1,518,310,967
|
||||
27 3,036,621,941
|
||||
28 6,073,243,889
|
||||
29 12,146,487,779
|
||||
30 24,292,975,649
|
||||
31 48,585,951,311
|
||||
32 97,171,902,629
|
||||
33 194,343,805,267
|
||||
34 388,687,610,539
|
||||
35 777,375,221,081
|
||||
36 1,554,750,442,183
|
||||
37 3,109,500,884,389
|
||||
38 6,219,001,768,781
|
||||
39 12,438,003,537,571
|
||||
40 24,876,007,075,181
|
||||
41 49,752,014,150,467
|
||||
42 99,504,028,301,131
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
isPrime =: 1&p:
|
||||
assert 1 1 0 -: isPrime 2 3 4 NB. test and example
|
||||
|
||||
loop =: verb define
|
||||
i =. x: y
|
||||
n =. i. 0
|
||||
while. y > # n do.
|
||||
if. isPrime i do.
|
||||
n =. n , i
|
||||
i =. _1 2 p. i
|
||||
end.
|
||||
i =. i + 1
|
||||
end.
|
||||
n
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
loop =: verb define@:x:
|
||||
i =. y
|
||||
while. y >: # i do.
|
||||
if. isPrime {: i do.
|
||||
i =. (, _1 2 p. {:) i
|
||||
end.
|
||||
i =. _1 (>:@:{)`[`]} i
|
||||
end.
|
||||
}: i
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
loop =: verb define@:x:
|
||||
i =. y
|
||||
while. y >: # i do.
|
||||
i =. (, (isPrime # _1 2&p.)@:{:) i
|
||||
i =. _1 (>:@:{)`[`]} i
|
||||
end.
|
||||
}: i
|
||||
)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
save_if_prime =: , (isPrime # _1 2&p.)@:{:
|
||||
increment_tail =: _1&(>:@:{`[`]})
|
||||
|
||||
loop =: verb define@:x:
|
||||
i =. y
|
||||
while. y >: # i do.
|
||||
i =. save_if_prime i
|
||||
i =. increment_tail i
|
||||
end.
|
||||
}: i
|
||||
)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
loop =: verb define@:x:
|
||||
i =. y
|
||||
while. y >: # i do.
|
||||
i =. increment_tail@:save_if_prime i
|
||||
end.
|
||||
}: i
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
While =: conjunction def 'u^:(0~:v)^:_'
|
||||
|
||||
loop =: verb define@:x:
|
||||
i =. y
|
||||
}: increment_tail@:save_if_prime While(y >: #) i
|
||||
)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
isPrime =: 1&p:
|
||||
save_if_prime =: , (isPrime # _1 2&p.)@:{:
|
||||
increment_tail =: _1&(>:@:{`[`]})
|
||||
While =: conjunction def 'u^:(0~:v)^:_'
|
||||
tacit_loop =: [: }: (increment_tail@:save_if_prime@:]While(>: #) x:)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
9!:37 ] 0 2048 0 222 NB. output control permit lines of 2^11 columns
|
||||
|
||||
(>:@:i. ,: tacit_loop) 42
|
||||
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 89 179 359 719 1439 2879 5779 11579 23159 46327 92657 185323 370661 741337 1482707 2965421 5930887 11861791 23723597 47447201 94894427 189788857 379577741 759155483 1518310967 3036621941 6073243889 12146487779 24292975649 48585951311 97171902629 194343805267 388687610539 777375221081 1554750442183 3109500884389 6219001768781 12438003537571 24876007075181 49752014150467 99504028301131
|
||||
|
||||
|
||||
NB. fix the definition. Here's the code.
|
||||
tacit_loop f.
|
||||
[: }: (_1&(>:@:{`[`]})@:(, (1&p: # _1 2&p.)@:{:)@:]^:(0 ~: (>: #))^:_ x:)
|
||||
Loading…
Add table
Add a link
Reference in a new issue