Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Balanced-ternary/J/balanced-ternary-1.j
Normal file
12
Task/Balanced-ternary/J/balanced-ternary-1.j
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
trigits=: 1+3 <.@^. 2 * 1&>.@|
|
||||
trinOfN=: |.@((_1 + ] #: #.&1@] + [) #&3@trigits) :. nOfTrin
|
||||
nOfTrin=: p.&3 :. trinOfN
|
||||
trinOfStr=: 0 1 _1 {~ '0+-'&i.@|. :. strOfTrin
|
||||
strOfTrin=: {&'0+-'@|. :. trinOfStr
|
||||
|
||||
carry=: +//.@:(trinOfN"0)^:_
|
||||
trimLead0=: (}.~ i.&1@:~:&0)&.|.
|
||||
|
||||
add=: carry@(+/@,:)
|
||||
neg=: -
|
||||
mul=: trimLead0@carry@(+//.@(*/))
|
||||
3
Task/Balanced-ternary/J/balanced-ternary-2.j
Normal file
3
Task/Balanced-ternary/J/balanced-ternary-2.j
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
a=: trinOfStr '+-0++0+'
|
||||
b=: trinOfN -436
|
||||
c=: trinOfStr '+-++-'
|
||||
7
Task/Balanced-ternary/J/balanced-ternary-3.j
Normal file
7
Task/Balanced-ternary/J/balanced-ternary-3.j
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
nOfTrin&> a;b;c
|
||||
523 _436 65
|
||||
|
||||
strOfTrin a mul b (add -) c
|
||||
----0+--0++0
|
||||
nOfTrin a mul b (add -) c
|
||||
_262023
|
||||
Loading…
Add table
Add a link
Reference in a new issue