複製鏈接
請複製以下鏈接發送給好友

五角星數

鎖定
五角星數(pentagram number)是5位的自冪數稱為五角星數。
中文名
五角星數
外文名
pentagram number
對    應
5位的自冪數
數    量
有3個
對    象
54748,92727,93084

五角星數定義

5位的自冪數成為五角星數。

五角星數數量與數值

五位的自冪數(10000-99999自然數範圍內)共有3個。
按順序依次為:54748、92727、93084

五角星數代碼實現

五角星數java方式

public class FiveFlowerNumberDemo {
    public static void main(String []flower_5) {//求取五角星數:
        System.out.println("符合要求的五角星數為:");
        int count = 0;
        for(int i = 10000; i<=99999; i++){
            int a = i/10000;//求取萬位上的整數;
            int b = i/1000%10;//求取千位上的整數;
            int c = i/100%10;//求取百位上的整數;
            int d = i/10%10;//求取十位上的整數;
            int e = i%10;//求取個位上的整數;
            //if((i/100)*(i/100)*(i/100) + (i/10%10)*(i/10%10)*(i/10%10) + (i%10)*(i%10)*(i%10) == i){
            if((a*a*a*a*a) + (b*b*b*b*b) + (c*c*c*c*c) + (d*d*d*d*d) + (e*e*e*e*e) == i){
                count++;
                System.out.println("第" + count + "個:" + i);
            }
        }
    }
}

五角星數編譯結果

符合要求的五角星數為:
第1個:54748
第2個:92727
第3個:93084