数学家生日

描述:某数学家的生日,月份和日期均为一位数,月份和日期组成一个两位数,这个两位数的3次方是个四位数,4次方是个六位数,四位数和六位数的各个数字是0~9这10个数字,且不重复,数学家的生日是?
 
  function getBirthday(){
        const monthMaxNum = 9
        const dayMaxNum  = 9
        for(let i = 0;i < monthMaxNum;i++){
            for(let j = 0;j < dayMaxNum;j++){
                let comBineNum = i*10 + j
                if(Math.pow(comBineNum,3).toString().length == 4 && Math.pow(comBineNum,4).toString().length == 6){
                    let resultNumStr = Math.pow(comBineNum,3).toString() + Math.pow(comBineNum,4).toString()
                    let first = Math.pow(comBineNum,3).toString().split('') 
                    let second = Math.pow(comBineNum,4).toString().split('') 
                    let result = Array.from(new Set([...first,...second]))
                    console.log(result)
                    if(result.length == 10){
                        console.log(i+'月'+j+'日出生')
                        return
                    }
                }
            }
        }
    }
    getBirthday()

  

原文地址:https://www.cnblogs.com/hjj2ldq/p/10914030.html