四葉玫瑰數是指四位數各位上的數字的四次方之和等於本身的數。(參考水仙花數)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>四葉玫瑰數</title>
<script>
for(var n=1000;n<10000;n++){
var a=parseInt(n/1000);
var b=parseInt(n%1000/100);
var c=parseInt(n%100/10);
var d=n%10;
if(Math.pow(a,4)+Math.pow(b,4)+Math.pow(c,4)+Math.pow(d,4)==n){
console.log(n);
}
}
</script>
</head>
<body>
</body>
</html>