Kroppeb
  • Member for 3 years, 6 months
  • Last seen more than a month ago
School moving out (Day 1)
14 votes

Brachylog, 4 bytes It's always nice to see a challenge and know brachylog is gonna beat everyone. Takes current classes as input and new classrooms as output; It will output true if it finds a way to ...

View answer
Missing numbers in arithmetic sum
9 votes

Brachylog, 22 16 bytes {Ṣ∧Ị∋|}ᵐ²ịᵐ.k+~t Try it online! -6 bytes thanks to @Fatelize Explanation {Ṣ∧Ị∋|}ᵐ²ịᵐ.k+~t { }ᵐ² # for each letter in each string Ṣ∧Ị∋ ...

View answer
Is this Pascal's Matrix?
7 votes

Brachylog, 28 24 23 bytes This feels quite long but here it is anyway -4 bytes thanks to DLosc by compressing the optional flips -1 bytes thanks to DLosc again by doing the partial sums in 1 go {|↔}...

View answer
Find the Factorial!
7 votes

Brachylog, 7 6 bytes By making a range and multiplying it -1 byte tanks to ovs having the idea to use the max() function ;1⌉⟦₁× Explanation ;1 -- If n<1, use n=1 instead (zero case) ...

View answer
RTA (Reverse-Then-Add) root of a number
7 votes

Brachylog, 24 22 bytes {~{ℕ≤.&≜↔;?+}{|↰₁}|}ᶠ⌋ 2 bytes thanks to sundar noticing that I had a {{ and }} Explanation -- f(n): -- g(x): { -- ...

View answer
Calculate the sum of the first n prime numbers
7 votes

Jelly, 4 bytes My first Jelly program RÆNS Try it online!

View answer
Evaluate Words Based on "Rules" (Skeptics.SE Crossover)
Accepted answer
7 votes

Python3, 105 103 bytes This is my first golf here so be kind =) -2 bytes tanks to Chas Brown lambda d,b,x,y,z:sum((x+y in i)-2*((z*b+x+y+z)[:3]in i)-(y+x in i)+2*((z*b+y+x+z)[:3]in i)for i in d)>0 ...

View answer
Sort by Largest Digit(s)
6 votes

Brachylog, 9 bytes {ȧdṫo₁}ᵒ¹ Note: due to how ordering works in brachylog, it does not work on number correctly. This is fixed by casting the number to a string (ṫ) at the cost of 1 byte. Try it ...

View answer
Test if a string is parenthesly balanced
6 votes

Brachylog, 28 bytes Ẹ|~c["(",A,")(",B,")"]∧A;B↰ᵐ Try it online! Explanation -- The string perfectly balanced iff Ẹ -- ...

View answer
That's a prime... almost
6 votes

Brachylog, 9 bytes Beating @sundar by using half as much bytes {~l~ḋ}ᶠ⁽t Explanation -- Input like [n,k] { }ᶠ⁽ -- Find the first n values which ~ḋ ...

View answer
Smallest number such that concatenation is a square
4 votes

Brachylog, 8 bytes ;.c~^₂∧ℕ Sadly enough it takes 3 bytes to check if a number is square and an extra ℕ is needed if the input is a square itself. Explanation ;.c~^₂∧ℕ # Find a value ;.c ...

View answer
Number that can eat itself
4 votes

Brachylog, 23 bytes ẹ{bkK&⟨h{≥₁+tg}t⟩,K↰|Ȯ} Try it online! This is a 1 byte save over Fatalize's solution. This uses a recursive approach instead of a iterative Explanation ẹ ...

View answer
Simulate an NFA
4 votes

Brachylog, 42 bytes ,0{hẸ&t|∋₁B∋IhJ&tJ&hhC∧I∋₁C∧It∋S&hb;B,S↰}ᵘ input as [string, nfa] where nfa is a list of state transitions [ initial state, letter, new states as list ] ...

View answer
A crowd of blank stares
4 votes

Brachylog, 14 bytes "(<>.<>)"aᶠckb Try it online! "(<>.<>)" # string aᶠ # get all Affixes (pre- and suffixes) c # ...

View answer
Print the Nth non-palindromic number
4 votes

Brachylog, 14 11 bytes ;0{<≜.↔¬}ⁱ⁽ -3 bytes tanks to Fatalize Explanation ; { }ⁱ⁽ -- Find the nth number 0 -- (starting with 0) < -- ...

View answer
Implement the 2D Hadamard Transform
3 votes

Brachylog, 23 bytes {ḍ\⟨+ᵐ↰₁ᵐ-ᵐ⟩c/₂ᵐ|}ᵐ\↰₁ᵐ Input: A list of columns Output: A list of rows How: It uses the Fast Hadamard Transformation. AFAIK Brachylog doesn't have matrix multiplication, nor ...

View answer
Calculating total slots
3 votes

Brachylog, 10 bytes It's always nice to see problem where Brachylog performs best ⊆Is₃ᶠ≠ᵐ∧Il Explanation ⊆I # Find the minimal ordered superset of the input (and store in I) where: s₃...

View answer
Would this string work as string?
3 votes

Python 3, 80 78 bytes I don't realy do many python code golfs but I thought I could give it a try -2 bytes: realised not(any()) is the same as all(not()) and could move the not into the r-string ...

View answer
Find a Rocco number
3 votes

Brachylog, 9 bytes Different approach then DLosc's answer Ċ-14&∋ṗ&× Takes N as output, gives [P, P-14] or [P+14,P] back through input (biggest number first) explanation Ċ # ...

View answer
Conjugation in Real Life
3 votes

Brachylog, 90 bytes ;Ṡ{hhH↰₂gB&hb~c[A,B,C]&tT;C↔↰U∧" under ",H,T;A↔↰,U|tT&hh,TgJ&hb;T↰Q∧J,Q|h} ~↰₃|↰₃ ∧"un";?c I made this while being under the impression that this could be ...

View answer
Expand some number
3 votes

Brachylog, 35 32 bytes l⟧₅;?z{tℕ₁I&h;10↔^;I×ṫ}ˢ;"+"zckc -3 bytes cause 0 isn't a valid input Try it online! or testsuite Explanation # implicit ...

View answer
Sum \$\text{Square}^2\$
3 votes

Brachylog, 12 8 bytes f^₂ᵐ+~^₂ -4 bytes thanks to Fatelize cause i didn't realize brachylog has a factors functions explanation f^₂ᵐ+~^₂ # full code f # get ...

View answer
Sum the deltas of my matrix
3 votes

Brachylog, 13 bytes orignally based of @sundar's design ⟨≡⟨t-h⟩ᵐ²\⟩c+ Explanation ⟨≡ \⟩ # Take the original matrix and it's transpose ᵐ # and execute the ...

View answer
Turn an Array into a Math Problem
3 votes

Brachylog, 34 32 bytes ~b≜ḅ⟨h⟨h≡^⟩l⟩ᵐs₂ᶠ{zh>₁&ttṅ|tt}ᵐ+ Try it online!

View answer
Sort by Multiplying
3 votes

Brachylog, 12 bytes {≤.;?%0∧}ᵐ<₁ Weird enough trying to multiply each variable by a number will start at trying to multiply by 2 and not 0 or 1. This seems to work though and beats both other ...

View answer
A knight's graph on an N-by-N board
3 votes

Brachylog, 65 40 33 bytes This breaks down for N bigger then 9. So I'm happy N can be only go to 8 =) ⟦₅⟨∋≡∋⟩ᶠ;?z{{hQ&t⟦₅↰₁;Qz-ᵐ×ȧ2}ᶜ}ᵐ -25 bytes by switching to KSab's formula -7 bytes by ...

View answer
Scoring 6,5,4 (AKA Ship, Captain, and Crew)
3 votes

Brachylog, 23 22 bytes +ᵐ-₁ᵐḍ₅+ᵐJo⊇~⟦₁3∧J+|∧0 +3 bytes but prints out 0 instead of false if no 4,5,6 (Fatalize) -2 4 bytes (sundar) One of my first branchylog programs. Can probably be golfed more. ...

View answer
The alphabet in programming languages
2 votes

B is for Brachylog, 2 bytes → Score: 11 Ạẉ Try it online!

View answer
Are my triangles similar?
2 votes

Brachylog, 23 21 bytes {{{⊇Ċ-^₂}ᶠ}ᵐz+ᵐo}ᵐz/ᵛ -2 bytes thanks to Unrelated String A predicate that only accepts similar triangles. Note that for negative values you have to type _1 instead of -1 ...

View answer
Parallel accounts (Day 2)
2 votes

Brachylog, 9 bytes Not as good as day 1. This one loses to Jelly {~c₂+ᵐ=}ᶜ Explanation { }ᶜ # Count the ways to: ~c₂ # Split the input array in 2 ... +ᵐ # so that their ...

View answer