Listes des termes d'une suite mathématique⚓︎

Soit \((u_n)\) la suite définie par récurrence par :

\[ \left\{ \begin{array}{ll} u_0 = 0 \\ u_1 = 1 \\ u_{n} = 5 u_{n-1} - 8 u_{n-2} \hspace{3ex} \text{pour} \hspace{1ex} n>1 \\ \end{array} \right. \]

On souhaite créer la fonction liste_termes qui renvoie une liste contenant les N premiers termes de cette suite. On suppose que N est strictement supérieur à \(1\).

Contrainte

On demande ici de programmer une fonction qui puisse renvoyer un nombre élevé de termes.

Exemples
>>> liste_termes(2)
[0, 1]
>>> liste_termes(3)
[0, 1, 5]
>>> liste_termes(4)
[0, 1, 5, 17]
>>> liste_termes(10)
[0, 1, 5, 17, 45, 89, 85, -287, -2115, -8279]

###(Dés-)Active le code après la ligne # Tests (insensible à la casse)
(Ctrl+I)
Tronquer ou non le feedback dans les terminaux (sortie standard & stacktrace / relancer le code pour appliquer)
Si activé, le texte copié dans le terminal est joint sur une seule ligne avant d'être copié dans le presse-papier
Évaluations restantes : 5/5

.128013lS^]et-dA5f18umag,_/R=in 6î)yàqPhcLN\[(bsx.p;r4C'0"ovw73êk:é *2030c090a0k0r050J0%0C050k0J0J0q0T0a0r0M0T020t030J0i0j0j0k0O0x02060U050i0|0U0s0%000k0j0M0N0%0p09160O0z0i090J030o13151719110M02031E1x1H0o1E110c0r0V0;0?0^0`0B0r0l0B051V0B0a0 030,0I05091Q0@0_0T1U1W1Y1W0a1'1)1$0a0O1F0a0B0;1c0J0M0k0s0`0(0T1+1S0T0f0.090s1k091$2123281-2b1)2e0j2g02040%0A0O0U0M0U0J0r1f1h0*1 0O0O090C2B1x2i0s1F0o1}2N1`1|1{1%0c2k0`1Y0s2d2y1$1N1P0=1,2X0r2Z0s0U2%1$0M2G1F2L2N2@12221h2(292-0O16050 0g2K2{102`2j2}1-2 310 0(3523372L2W0T3c0k32020Y3g2M113j3a0`3m3o0P3r3i2{3k3x0 0e3A3t3C3v3l0U303n0 0u3H382|1R3b3M3d020X3A1I2=1x2%2Q0c1|2V3K0C2.2q0)1O1F2;092?363!3-0*3^393U0`0!0 0*0f3A0%3S3D0f0 1Y0J0a090n4d301v3!3u3 0T0~020H4j3J4l0s0 0E4q3~2)4m0 0w0#3H0%4E464k4y4t024g2p1w1y364G4r4y0U0 0q45473K4n0G4w3T4y0j0r0 0S4W4H2941020f3M4+4R2~0 0!4=4x290U0W0 2+4`4$2~0I0 0O230l094#3k4n4p4O3h4X4s4u5a4Y4A084D4F5g4I0 4L4i5e2M5p294Z5j4l4'4)5z4y4n5m5u024Q4{1-4T024V5H5J521-5B024*5H0t4F5Q3D5r094h4N2_4,1-5y5H5w5S4(02345,5)0`5F513k5M5O2@5Z3K5T5;2@5X5o5?0T4.4:0O5_3K4J0s6a4l4}4 6d5P5-3w5402560s585D5x0 5d5(4?5.3e6r5*0 0m6e5q024v5=6w5@4A4C5W5Y5Y6k3l5#5%6z6J024!6H5K3w0 6i6v6Y4z025G5}6P5{6D295T3G6j655M0'6-3b6R4M6T6'6W6$5R6Z026#4P6+0 0b6^0`606|5^6;6I0T5M777d6%5T0h787f0 6@7i706Q4K5$6{6X7r5+6 5!727m7g7m5T3f7w5b0 6)36634E6P4.2G0a0i0O733h5~5h7t6S5W1x3{3@3#7%0o3'1x0a3)7+2T2O0k1(7(3'1D3}7r2G0j0n0f0k0!4e0B0Y0 1p1r1t1v0%6L2_1K371E0D0k0%0c0$2b0s2A0r1g0%0O0$0C7S2z0V1*2D0?0%132A1*2x7S562A0%2+0C8B0O0%0y0%8r0O0r2G0%8y4:0s2I8n1h0k8v0C0%0i2Z0%8V8X8o8q8s0O8u090L1I8d020Q090M2d0c230a0m8H058)0k1e0%0l170*8L8N050R1v2;8G870;0B0k9h0k0M8{928x8g8*2B0%2d1`0k0v8(0*0i0K0%941`889m9o0:8N0C0+4d0%0j0Z2p8)1g8+0s0L0%0d2+2z909c9H099p1*9L1?1*9s8Y0%8D8L6P172A0B164d0K0 0F0H0E0F0w455s0:0l0$0s0$2G567W4y9?1}9_099{029}0(079 a15P9%0/909L0%1t0r8p8|8T9r9T9t8{0i9u0f2b0C0kas9:8h1*0l6o0*0:0V3n098taLab29ad9^0k9`9|9~a03A900+9O9Q1*130J9L0M0|7=8h0Ra!4d2+0c8S8y1Y4'9N2D8-8t9.0caD0?6p0k582t0x1}1g8=8c117)0+0-0/02.

###(Dés-)Active le code après la ligne # Tests (insensible à la casse)
(Ctrl+I)
Tronquer ou non le feedback dans les terminaux (sortie standard & stacktrace / relancer le code pour appliquer)
Si activé, le texte copié dans le terminal est joint sur une seule ligne avant d'être copié dans le presse-papier
Évaluations restantes : 5/5

.128013[(lbLEsS]et.ph;rd45-jf'180uma"ovwg,_/R3=in Oîk:é)y *q2PcN030l0e0f0x0J070b0T0Y070x0b0b0I0y0f0J0h0y020L030b0v0w0w0x0k0S020c0z070v0?0z0K0T000x0w0h0j0T0G0e100k0V0v0e0b030F0}0 11130{0h02031y1r1B0F1y0{0l0J0A0+0-0/0;0i0J0C0i071P0i0f0_030%08070e1K0.0:0y1O1Q1S1Q0f1Y1!1W0f0k1z0f0i0+160b0h0x0K0;0W0y1$1M0y0q0(0e0K1e0e1W1{1}221'251!280w2a02040T0X0k0z0h0z0b0J191b0#1_0k0k0e0Y2v1r2c0K1z0F1@2H1;1?1=1X0l2e0;1S0K272s1W1H1J0,1%2R0J2T0K0z2X1W0h2A1z2F2H2.0|1|1b2Z232'0k10070_0s2E2=0`2;2d2@1'2_2{0_0W2 1}312F2Q0y360x2|020H3a2G0{3d340;3g3i0m3l3c2=3e3r0_0n3u1C2,1r2X2K0l1?2P3p0y0Y2(2k0!1I1z2+0e2-303B3M0#3U331L1'0O0_0#0q3u0T322?3#3q0q0_1S0b0f0e0E3@2`1p3B3o3.0y0^02063}3w3K0K0_0Z443!2!400_0R0P3u0L0T4j3+3~4c47023`2j1q1s304l453 0z0_0I3*3,3e41054a3-4c0w0J0_0u4G4D0_0D4B4m234J2}4N3K410d4h4k4v4b233%020q0z0k4R4w4n0_0K4-4%1'0z0B0_2$4=4H2^080_0k1}0C0e4W3 41434t3b4C3K4U0239592G5b564P4|3x48554c414f4!4#4k5i4/4p0e3{4s2:4S4@0_0g5o2^0_0x0h0h270l5G1'575O0;5d3A5g024$4}5D020U5l460_4q3|5V5v234E5R3f4:5$4x0_0o5;4I4K022~5*5C0;4Y5^234y025@5V5X3e5d0t615Z5#665+355'5y4r5.5-5}4.5H024;6e5~0y63652.675c5`5f5B6n5P0_0d0R5s4j6f0;4(2A0f0v0k6q6w6J5/5x5z4h1r3X3T3C6Z0F3F1r0f3H6'2N2I0x1Z6#3F1x3Z5Y0;2A0w0E0q0x0O3^0i0H0_1j1l1n1p0T4g5*1E311y090x0T0b16180J1a0T2+2q2s1#0-1_0K3?0k0v2C7i2w0v0T1.0e0x7y1|0k0T0x0p0z180*0}0Y0Y1p2t0q0b5F796;0a0%0K0f0T0l1a0K0Q0T740T070r7j3M0K280N7Z277!0Q08187!1#4*0K7v7j1!0T2'0w082A7!0r0Q070Q2j7Y0*0l7y7A7C0D7*7d0Y0k0Q0x2v7!8g6-1!7C7G6O0'7Z0Q0C3h1k277Z0h7y0b7|0'867E7q7s7u8q771F3P2Y3 1)1R1T1V6=3e2g27290_2m0c8m0@7Z0X0S1@1a3B3S6=2/3V6Y8!5%6U6j6r6C0;634A8 4?5 0_4F6m950y5d4M946?0y4(4*4,9e5m020O6b914_024{9k464 02510K536k0_586B9a4o49999f5q4Z5V0{0F8`6!2H6:1A020M1b7C512u0T270}9Y3M1f8a0f7'818h7y7?7h3=1}7Z7+2$1H7O761C312X3e8W1+1U2b9024262i2k8)8+0h8-8/0i8;5*8?3,8^5a9O6s4o5(5A3V6s6l9D9f4o0J9A029K6R6s929o9b5`5Uaza3636daG9E6h6V9H4O0298as9lav9t5=64aC5d5|aS4X6EaC6uaY5`6aaV4caIaCam6i5)a#5jaQ5.aua'5?a)38away309M9O1E3D6$3Q9M0#0%0(0b02.