Skip to content

Commit

Permalink
refact: include suggestions from Marshall
Browse files Browse the repository at this point in the history
  • Loading branch information
Panadestein committed Aug 22, 2024
1 parent 269e06b commit 4fd8c0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/bqn/rollim.bqn
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ LISA¨ ⟨0‿1‿0‿3‿2‿3, 10‿9‿2‿5‿3‿7‿101‿18, 7‿7‿7‿
8 {n𝕊ij: ((⌜´0=)(0=-⌜´)0=+⌜´) ji-¨<↕n} 23

NQ ← {𝕊n:
qs ← (00×·¨⊢∾·˜+˜)n
I ← (⊢∾-⋈+)´VP ← ⟨´⊣⊑¨˜I, {1(𝕩)𝕨}¨I
s{n𝕩 ? (𝕨V𝕩)⟨(𝕩+1)𝕊˜𝕨P𝕩⋈⊢,@⟩¨ n; q+1}0q
VP ← {⊣𝕏(⊢∾-⋈+)´}¨´¨˜, {1(𝕩)𝕨}¨
0{n𝕩 ? +´(𝕨V⊢)⟨(𝕩+1)𝕊˜𝕨P⊢,0(𝕩⋈⊢)¨ n; 1}˜(0×·¨⊢∾·˜+˜)n
}
(NQ¨ 1+↕8) a00017010021044092
7 changes: 4 additions & 3 deletions src/rollim.org
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ Wirth implementation:

#+begin_src bqn :tangle ./bqn/rollim.bqn
NQ ← {𝕊n:
q‿s ← (0⋈0×·↕¨⊢∾·⋈˜+˜)n
I ← (⊢∾-⋈+)´∘⊢ ⋄ V‿P ← ⟨∨´⊣⊑¨˜I, ⊣{1⌾(𝕩⊸⊑)𝕨}¨I⟩
s{n≠𝕩 ? (𝕨V𝕩⊸⋈)◶⟨(𝕩+1)𝕊˜𝕨P𝕩⋈⊢,@⟩¨ ↕n; q+↩1}0 ⋄ q
V‿P ← {⊣𝕏(⊢∾-⋈+)´∘⊢}¨ ⟨∨´⊑¨˜, {1⌾(𝕩⊸⊑)𝕨}¨⟩
0{n≠𝕩 ? +´(𝕨V⊢)◶⟨(𝕩+1)𝕊˜𝕨P⊢,0⟩∘(𝕩⋈⊢)¨ ↕n; 1}˜(0×·↕¨⊢∾·⋈˜+˜)n
}
(NQ¨ 1+↕8) ≡ a000170 ← 1‿0‿0‿2‿10‿4‿40‿92
#+end_src

#+RESULTS:
: 1

Which nicely compares with the OEIS [[https://oeis.org/A000170][sequence.]]

#+BEGIN_EXPORT html
<div style="text-align: center; font-size: 2em; padding: 20px 0;">
<a href="#" onclick="goBack(); return false;">⊑∘∞</a>
Expand Down

0 comments on commit 4fd8c0e

Please sign in to comment.