J is particularly strong in the mathematical, statistical, and logical analysis of data. It is a powerful tool in building new and better solutions to old problems and even better at finding solutions where the problem is not already well understood.
J systems have:
- an integrated development environment
- standard libraries, utilities, and packages
- a form designer for your application forms
- an event-driven graphical user interface to your application
- interfaces with other programming languages and applications
- integrated 2d and 3d graphics
- memory mapped files for high performance data applications
+/((0=5|y)+.(0=3|y))#y=:i.1000
+/((0=3|y)+.0=5|y)#y=:i.1000
+/(~.,>1000(13 :'y*i.(>.x%y)')each 3 5)
+/~.,(>(13 : '0=x|i.1000' each 3 5))#y
+/~.,>13 :'(0=y|a)#a=.i.1000' each 3 5
+/~.,>(13 :'(0=y|a)#a=.i.1000')"0(3 5)
+/((0=y|~3)+.(0=y|~5))#y=:i.1000
+/~.((0=5|y)#y),((0=3|y)#y=:i.1000)
+/~.,I.(0=3 5|>(y;y=:i.1000))
+/~.,I.0=3 5|>y;y=:i.1000
+/I.+./0=3 5|>(2#<i.1000)
+/~.,I.0=3 5|>(2#<i.1000)
+/I.+./0=3 5|/i.1000
+/I.+./0=3 5|/i.1e3
3 5 (13 : '+/I.+./0=x|/i.y') 1e3
3 5(13 :'+/I.+./0=x|/i.y')1e3
+/(+./0=3 5|/y)#y=:i.1000
+/y#~(+./0=3 5|/y=:i.1000)
+/I.1<15+.i.1e3
NB. (this version I found somewhere. +.
is GCD)
+/b#~0=2|b=:a#~4e6>a=:1{"1 +/\@|.^:(i.33)0 1x
+/b#~0=2|b=.a#~4e6>a=.1}.fibonacci 100
(using built-in fibonacci
)
_1{q:600851475143
0}|.q:600851475143
>./p#~(13 : '(":y) -: |.":y')"0 p=:~.,a*/a=:100+i.900
>./p#~(": -: [: |. ":)"0 p=:~.,a*/a=:100+i.900
>./p#~(":-:[:|.":)"0 p=:~.,a*/a=:100+i.900
*./>:i.20
((+/a)^2)-+/(a=:>:i.100x)^2
((2^~+/)-+/@:*:)>:i.100x
p:10001-1
d=:'7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450'
>./*/"1 "."0 d{~(i.(#d)-n)+/(i.n=:7)
x:*/0{c#~1000=+/"1 c=:b,.%:+/"1(2^~b=:>,500{@(;/&i.)500)
x:*/0{c#~1000=+/"1 c=:b,.%:+/"1(2^~b=:500 500#:i.a*a=:500)
x:*/0{c#~1000=+/"1 c=:b,.%:+/"1(2^~b=:>,a{@(,&<)a=:i.500)
+/p:i._1 p:2e6
TBW
f=:13 : 'y*(y+1) % 2x'
num_divisors=:13 : '(*/(+/"1=q:x)+1)'
f (3 : 'while. (num_divisors f y)<500 do. y=.y+1 end.') 1
10{.":+/x:".'m' fread 'euler_project_problem13_string.txt'
1{"1+/\@|.^:(i.20) 0 1
}.(%-.-*:)t.i.20x
(using Taylor coefficients)
w {~I.a=>./a=:># each w=:LF cut fread '/usr/share/dict/words'
w{~I.a=>./a=:>#each w=:'b' fread '/usr/share/dict/words'
x#~-.x e.~.,(x*/x=:2}.i.100)
(inefficient)
(-.x e.~.,(x*/x))#x=:2}.i.100
(inefficient)
x#~1=+/0=(x|/x=:2}.i.100)
(inefficient)
2+I.1=+/0=x|/x=.2}.i.100
(inefficient)
ff=.13 : '*/*2}.(i.y)|y'
2}.I.>(ff each i.100)
p:i.20
(very efficient)
>(13 : '+/1=x+.>:i.x')
>5 p:
(built-in)
step f size
): (13 : '1(x|.}.)^:(a)a=:i.y')
(!^:_1)120
3 : '(y+i.3) { ''abcdefghijkl''' each i.10
w
) are sorted?: ((w=(w/:&.>w))#w)
((w=(/:~&.>w))#w)
(w=(|.&.>w))#w
(\: #&.>w){w
>,{ 1 2 3;4 5 6;7 8 9
(~:/\)
(~:/\^:_1)
(the inverse (^:_1
) of Gray to binary)
+/\(?(100 # 2)){(_1 1)
+/\(_1 1){~?(100#2)
(more natural variant, IMHO)
(+/x);y;x[x =:(y=:?10#10) e.(1,2,3)
y
times):
replicate =: 3 : 0 : z =. '' for_i. i. x do. z =. z, ". y end. NB. Format to matrix (x,(#z)%x) $ z )Example:
10 replicate '[ >./ +/\ (? (1000 # 2)) { (_1 1)'
(result of 10 Gambler's ruin runs)
do 10#,:'[ >./ +/\ (? (1000 # 2)) { (_1 1)'
(>./ +/\ _1 ^ 1000 10 ?@$ 2)