Skip to content

Instantly share code, notes, and snippets.

@Hayao0819
Created November 23, 2021 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hayao0819/e7fd78a0e1b63f57ab3ae173d2acd80c to your computer and use it in GitHub Desktop.
Save Hayao0819/e7fd78a0e1b63f57ab3ae173d2acd80c to your computer and use it in GitHub Desktop.
x^y=y^xの組み合わせを見つける
// RunProcess(最小指数, 最大指数, 底)
function RunProcess(startNum, processMax, ProcX){
for (let i = BigInt(startNum); i <= processMax; i++) {
let AnswerA, AnswerB
ProcX=BigInt(ProcX)
// ProcY=BigInt(processMax)-BigInt(i)
ProcY=BigInt(i)
console.log(`検証: ${ProcX} ** ${ProcY}`)
if (ProcX === ProcY ){
continue;
}
AnswerA = ProcX ** ProcY
AnswerB = ProcY ** ProcX
if (AnswerA === AnswerB){
console.log(`結果: ${ProcX} ^ ${ProcY} == ${AnswerA}`)
}
}
}
const AllMax = 1000n
for (let x = BigInt(0); x <= AllMax; x++) {
RunProcess(0,AllMax, x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment