佩尔数计算器

输入一个数字,判断其是否为佩尔数,或输入N计算第N项佩尔数与总和。

佩尔数判断或计算第N个佩尔数与总和

什么是佩尔数?

佩尔数是一种特定的数列,定义为:佩尔数 \( P_n \) 由以下递推关系生成:

  • \( P_0 = 0 \)
  • \( P_1 = 1 \)
  • \( P_n = 2P_{n-1} + P_{n-2} \) (对于 \( n \geq 2 \))

如何判断佩尔数?

  • 生成佩尔数:通过定义生成足够多的佩尔数,直到达到或超过特定的数字。
  • 比较:检查数字是否在生成的佩尔数中。
  • 结果:如果存在,则该数字属于佩尔数;否则不属于。
  • 示例

    例子 1:判断 6 是否为佩尔数

    解答:

    计算佩尔数列:

    \( P_0 = 0 \)

    \( P_1 = 1 \)

    \( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)

    \( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)

    \( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)

    结果:

    \( P_4 \) 已经超过 6 了,所以,6 不是佩尔数。

    例子 2:判断 70 是否为佩尔数

    解答:

    计算佩尔数列:

    \( P_0 = 0 \)

    \( P_1 = 1 \)

    \( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)

    \( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)

    \( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)

    \( P_5 = 2P_4 + P_3 = 2 \times 12 + 5 = 29 \)

    \( P_6 = 2P_5 + P_4 = 2 \times 29 + 12 = 70 \)

    结果:

    \( P_6 = 70 \),所以,70 是佩尔数。

    例子 3:计算第 8 项佩尔数与总和

    解答:

    计算佩尔数列:

    \( P_0 = 0 \)

    \( P_1 = 1 \)

    \( P_2 = 2P_1 + P_0 = 2 \times 1 + 0 = 2 \)

    \( P_3 = 2P_2 + P_1 = 2 \times 2 + 1 = 5 \)

    \( P_4 = 2P_3 + P_2 = 2 \times 5 + 2 = 12 \)

    \( P_5 = 2P_4 + P_3 = 2 \times 12 + 5 = 29 \)

    \( P_6 = 2P_5 + P_4 = 2 \times 29 + 12 = 70 \)

    \( P_7 = 2P_6 + P_5 = 2 \times 70 + 29 = 169 \)

    \( P_8 = 2P_7 + P_6 = 2 \times 169 + 70 = 408 \)

    结果:

    第 8 项佩尔数是 408,其总和为 696。

    前 100 个佩尔数

    • P0 = 0
    • P1 = 1
    • P2 = 2
    • P3 = 5
    • P4 = 12
    • P5 = 29
    • P6 = 70
    • P7 = 169
    • P8 = 408
    • P9 = 985
    • P10 = 2378
    • P11 = 5741
    • P12 = 13860
    • P13 = 33461
    • P14 = 80782
    • P15 = 195025
    • P16 = 470832
    • P17 = 1136689
    • P18 = 2744210
    • P19 = 6625109
    • P20 = 15994428
    • P21 = 38613965
    • P22 = 93222358
    • P23 = 225058681
    • P24 = 543339720
    • P25 = 1311738121
    • P26 = 3166815962
    • P27 = 7645370045
    • P28 = 18457556052
    • P29 = 44560482149
    • P30 = 107578520350
    • P31 = 259717522849
    • P32 = 627013566048
    • P33 = 1513744654945
    • P34 = 3654502875938
    • P35 = 8822750406821
    • P36 = 21300003689580
    • P37 = 51422757785981
    • P38 = 124145519261542
    • P39 = 299713796309065
    • P40 = 723573111879672
    • P41 = 1746860020068409
    • P42 = 4217293152016490
    • P43 = 10181446324101389
    • P44 = 24580185800219268
    • P45 = 59341817924539925
    • P46 = 143263821649299118
    • P47 = 345869461223138161
    • P48 = 835002744095575440
    • P49 = 2015874949414289041
    • P50 = 4866752642924153522
    • P51 = 11749380235262596085
    • P52 = 28365513113449345692
    • P53 = 68480406462161287469
    • P54 = 165326326037771920630
    • P55 = 399133058537705128729
    • P56 = 963592443113182178088
    • P57 = 2326317944764069484905
    • P58 = 5616228332641321147898
    • P59 = 13558774610046711780701
    • P60 = 32733777552734744709300
    • P61 = 79026329715516201199301
    • P62 = 190786436983767147107902
    • P63 = 460599203683050495415105
    • P64 = 1111984844349868137938112
    • P65 = 2684568892382786771291329
    • P66 = 6481122629115441680520770
    • P67 = 15646814150613670132332869
    • P68 = 37774750930342781945186508
    • P69 = 91196316011299234022705885
    • P70 = 220167382952941249990598278
    • P71 = 531531081917181734003902441
    • P72 = 1283229546787304717998403160
    • P73 = 3097990175491791170000708761
    • P74 = 7479209897770887057999820682
    • P75 = 18056409971033565286000350125
    • P76 = 43592029839838017630000520932
    • P77 = 105240469650709600546001391989
    • P78 = 254072969141257218722003304910
    • P79 = 613386407933224037990008001809
    • P80 = 1480845785007705294702019308528
    • P81 = 3575077977948634627394046618865
    • P82 = 8631001740904974549490112546258
    • P83 = 20837081459758583726374271711381
    • P84 = 50305164660422142002238655969020
    • P85 = 121447410780602867730851583649421
    • P86 = 293199986221627877463941823267862
    • P87 = 707847383223858622658735230185145
    • P88 = 1708894752669345122781412283638152
    • P89 = 4125636888562548868221559797461449
    • P90 = 9960168529794442859224531878561050
    • P91 = 24045973948151434586670623554583549
    • P92 = 58052116426097312032565778987728148
    • P93 = 140150206800346058651802181530039845
    • P94 = 338352530026789429336170142047807838
    • P95 = 816855266853924917324142465625655521
    • P96 = 1972063063734639263984455073299118880
    • P97 = 4760981394323203445293052612223893281
    • P98 = 11494025852381046154570560297746905442
    • P99 = 27749033099085295754434173207717704165
    • P100 = 66992092050551637663438906713182313772