Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

math: uniquePaths and leastCommonMultiple return non-integers below 2^53; iterative Euclid is subtraction-based and can hang

オープン
#2,238 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@Shubham-Padkonde がすでに取り組んでいます。

2026年10月23日 から。

  • #2243 @Shubham-Padkonde による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
javascript

調査の方向性

The issue points to pascalTriangle, dpUniquePaths, leastCommonMultiple, and euclideanAlgorithmIterative, and compares the iterative Euclidean implementation with the recursive % version in the same folder. Read those implementations and their existing tests, then reproduce the reported inputs. Done means the three functions return the stated correct results and the iterative algorithm handles large inputs promptly; an open pull request is already linked.

索引モデルが issue の本文から書いたものです。

説明

Three small issues in the same family. All the true results fit safely in a JS number.

  • uniquePaths(23, 36) returns 3489348548829780.5 (a non-integer). uniquePaths(29, 29) returns 7648690600760441, but dpUniquePaths gives the correct 7648690600760440. Cause: pascalTriangle multiplies before dividing, so the intermediate product exceeds 2^53. 25 wrong grids up to 40×40.
  • leastCommonMultiple(549533988, 76324165) returns 2747669939.9999995; expected 2747669940. Cause: Math.abs(a * b) / gcd overflows before dividing. Fix: Math.abs(a / gcd * b).
  • euclideanAlgorithmIterative uses repeated subtraction, which takes O(max/min) steps. (1e8, 1) takes about 1 s and (2**53 - 1, 2) effectively never finishes, while the recursive % version in the same folder takes under 1 ms. Fix: use %.

Found during an independent property-based audit of this repo (full report and reproducible harness: https://github.com/devladpopov/algorithm-autopsy/tree/main/autopsy-02).

主要言語
JavaScript
スター
197k
フォーク
31k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

trekhleb/javascript-algorithms のほかの issue

trekhleb/javascript-algorithms の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。