Sub Détail()
Dim tablo%(1476, 308), R$(1476), i%, j%, v%, ret%, flag As Boolean
tablo(1, 308) = 1: R(0) = 0: R(1) = 1
For i = 2 To 1476
For j = 308 To 0 Step -1
v = tablo(i - 2, j) + tablo(i - 1, j) + ret
tablo(i, j) = v Mod 10
ret = -(v > 9)
Next
flag = False
For j = 0 To 308
If tablo(i, j) Then flag = True
If flag Then R(i) = R(i) & tablo(i, j)
Next
Next
[B2].Resize(1477) = Application.Transpose(R)
End Sub
Sub Détail2()
Dim N% '0 < N < 4902'
N = 4901
[B2].Resize(N + 1).Value = FIBO9(N)
End Sub
Function FIBO9(N%)
Dim i%, j%, Tmp&, Retenue&, Drapeau As Boolean
Dim NbTranches%, Tranche&(), Fibonacci$()
NbTranches = Int(N * 2.32208489166643E-02 - 3.88316669075566E-02)
NbTranches = NbTranches - (NbTranches < 0)
ReDim Fibonacci(N, 0), Tranche(N, NbTranches)
Fibonacci(0, 0) = "'0": Fibonacci(1, 0) = "'1": Tranche(1, NbTranches) = 1
For i = 2 To N
For j = NbTranches To 0 Step -1
Tmp = Tranche(i - 2, j) + Tranche(i - 1, j) + Retenue
If Tmp > 999999999# Then
Tranche(i, j) = Tmp - 1000000000#: Retenue = 1
Else
Tranche(i, j) = Tmp: Retenue = 0
End If
Next
Drapeau = False
For j = 0 To NbTranches
If Drapeau Then
Fibonacci(i, 0) = Fibonacci(i, 0) & Right$("000000000" & Tranche(i, j), 9)
ElseIf Tranche(i, j) Then
Fibonacci(i, 0) = Fibonacci(i, 0) & "'" & Tranche(i, j): Drapeau = True
End If
Next
Next
FIBO9 = Fibonacci
End Function
F[SUB]19998[/SUB]= | 966817976622597392505389639447863833604305538946569395770684424586731977908107496102675488959615515533772250422123853636546515941616347570994622278922520734725743138750342781669387595830284087272188829853955420224723791570373007618731469028888571186542445829764840777257978444031645128670450077384952259274387072892768336620626082492583895703591521954105863785694941898112007028484102374289359522934661231163144402428934224152332467940947157160567279465334674567080394778117575351652603644964981287088534295004755507944406298932849105489661865260254687307116450017191759777457760768660904496509661926506497086883579300471414888494104414554923159548768305215356541106776547826209629020186096644113218163519225041952359598134626728622975128963620880483187519996039098788482370098301323892881684347090693963439251678053782826236503867923235759593434973403080680115200540819883708126374073962554440829333380984083450998610713734761539316125330820049669760498110140675348463403648420526090621056928736683555136139943681036191364281263701883416685711113531944147313137725984683669088512580807044030504939031675705205295079856324314546902583931357396166250805846843795830066987441606412086233599982127945114656123619921139315694683676375525744672131883351432908473336978246338772438321357794118597211088894209570440049130842643064661740231918704296743701813436271400335000039656375821113342961958347776459201635945538712645278227494843244614843039893634265485472121190630439306069033101412579272409855924835988646627538891147528105307869170370980103533087444899493039638182632921313581556678060165675023893248987711015951420214450855636206445365920887946368102569407633466654214787935042429967856601749632876781385700842965097629396354023313587443506199282215653747210121813360412747625285352514024300717903821706402811274713569913449700592194769824830844179446018547774873049597338479027928398067811010408948092751065650044991301201396316238933975439607680250068294815575331993861235388679086398873677688281358030172988865558029391356541009689353897233859415251293815121660647321436345194058125701421745583797449100977269491732908682955128956816123458735772850455312513801944695250388487663025379402066326757974318622271065794149384953845753071266982540716946181943636236752852752780373407597486241624794445386859578929050603594334640219796773014678633289806827249523410069707991763627166294729109758415061458658249684003236839721663528680254801207294226211770460787505950825842000957165221678495783682754067177024117578281876069935742898519114851988938136182913431075723058963136751314115219828235527819543546303081310416894554202428761672412631816351331862294826605079995891200929486259897512122580003736780850925075813366025314945485249990027343713249110120897707535536142370521322562323229826000329802330014919822320205779143571026510040982291858862199576652148599730967451211419724871321763921106342112715411199538291111635098134177229637115830933452562717496006747950522876714163190688414372770181383954028899935056648016288975713877029708748919592030890379622424577226617259433338798351237884237037448694917759482291548167556943878266721513978861410612679660279883586191287522962966775913534159904534147154821361681114891700051947312759704940746540720828002498295652666487330465420478378600438101657121953449189871200746064407442696448707154631475989209127945804055665069027004342676075404667974754186513669041652708806332695347931240455703251585604063224438670753781511810057074195257169784831031568587091036457410715279232165149116975142522460887885165647517295467426403089026710724239722018803146412341364292219959759901015460161900317509792230791445942019588821954425725419506996711803768176781814538584152723899813550699542285355893376584494824773110696643884567093745675877161883412153914919051835605325012510911260252654947793640133815179315165897076388306176841804561893598393295930545310920862470761954790809531418715330577954791979422988040554230870135857172295183307163832781044596940047716469268926284231391780927670424822556156554355495701474350362383853788766388814428245103264478191996887153087258514892322315836514103684510964053128299691530897538287842201475624 |
F[SUB]19999[/SUB]= | 1564344347109763849734765364072743458162050946855915883181245417404580803852433819127477934504143316103671237797087184052487157589846395314335101792632666883301188491698850377253383735812017943059782268835280360618754466932406192674904182868594738499500415166599602737300793712012046275485369495600019495004126039595217556097603510836899682827827626851274417838565958464881549888154511565687715162081527027421167926710592169405764372872023265791851279526521097739802047796738013885512616267273220024096214780132567479711643567372517808245262560562426651659391013837988476506124649092538307827326285964637268328029765707984607120961599796336714632362497169952413163370558311283612961033588836334352432860332222878648950508154331165678617373097939647648015552782638392654938551724289386017566932982065441392025369213734676739845068956966278536757235977421127565055467060906533383001625925978595472181091151062798507286798754728450358266089744616465914255799764431508559485853637841082521780322710748029546001980460990695999087046617731317608498316428164179967150350939374702201821818895349621858954893061034598954341939850973673870946183079728029105624782161827626661367017673681922257604178810154438462080217794489109678386881153826838075832058191153133704042628156419344516917867369755345135618986917642004521509538436204298618130363401395547933177643760161135638357088649014469358006518300404036431113143777969391584246934245800739809135619744598808977628245309941537928439431608665523308894967310600529498446943933665468406306292762942409786097847875240014036353917928156220446650579514092031254308059314931618726692376640987446459276331196950780063664171751110087644649773058213117640640085100552927878404516279461437503857017398937097042607258059612257878307007002086913210922626760728342901272768408974906007921227446242552261362505471751722906558235533709070548109789519920405521647836164156675304784097782435865165640401897107828859121831521126567446611716077075769257072773697947064329836969249852382976202348037425889031090020976240691949742160088733357875561841760194799534815496104106903184713919847662253483806138312440578732122855388348848736018217032877013531004653902335692761900988709302797685265501972628217528866551995479526195626503247164073793787381643388365618488630255600890924552511767690989186316859159306438477097458585889829326938198129884953178437411315486719927412151054551726325421747462698125767761987300812744880048122138953746796038485281452086680809803469350470844184375258620810652745992631459076192613797545486775651410699327289089628593588395142531659083933746399666161863597357735290387376161440280731398703030590410957840047591721635117677190494658658256770952605314604687704388833897300447300322491720569722311756874534871145435101596346787454258165870310592717473670917638475152605474446188958081898150393481484970581519902582271877141251593259282483539345792009117894084860435326938689664322383123823631494470354941767039585133484331342468806167901166928052638999423311570618981137348891538818027216596300491989181231598151123614651043205656474490923109982595235880446420678700336717534914381729578113169753046083981752465156933790288020841880688083888166659362896648911608716373579944854235997384986302902608821566689026676371268703303207406827737925274781301986480762462594420398637607893961010824979395439225300832931626540179218558345947558472159906873998923767432504278838419479068093778976997276416592421223235719653905071392295735398272851826350645605643470417155719500185143594804374322010189545136205568856276559806316789533450612097900180399440915139647060459321993254566103255011590902408116018722996267956826555434955409390951728022815209412027248353062982911544674007147249326697275010788100666958314965810320432736615962898175585320993128871046552842068867557341007383399180807449030159797672605530835244157256109268527578172314358255179589605335375414082046575557122636364391407861922824529441261003866098066404526541912783214030236752423547997110159548536582622929575859635210831021463323632502412193578592457118234067116894159316798758933206918936334540039454055299101076302263831614132510576874528929742319396129011617501 |
F[SUB]20000[/SUB]= | 2531162323732361242240155003520607291766356485802485278951929841991312781760541315230153423463758831637443488219211037689033673531462742885329724071555187618026931630449193158922771331642302030331971098689235780843478258502779200293635651897483309686042860996364443514558772156043691404155819572984971754278513112487985892718229593329483578531419148805380281624260900362993556916638613939977074685016188258584312329139526393558096840812970422952418558991855772306882442574855589237165219912238201311184749075137322987656049866305366913734924425822681338966507463855180236283582409861199212323835947891143765414913345008456022009455704210891637791911265475167769704477334859109822590053774932978465651023851447920601310106288957894301592502061560528131203072778677491443420921822590709910448617329156135355464620891788459566081572824889514296350670950824208245170667601726417091127999999941149913010424532046881958285409468463211897582215075436515584016297874572183907949257286261608612401379639484713101138120404671732190451327881433201025184027541696124114463488665359385870910331476156665889459832092710304159637019707297988417848767011085425271875588008671422491434005115288334343837778792282383576736341414410248994081564830202363820504190074504566612515965134665683289356188727549463732830075811851574961558669278847363279870595320099844676879457196432535973357128305390290471349480258751812890314779723508104229525161740643984423978659638233074463100366500571977234508464710078102581304823235436518145074482824812996511614161933313389889630935320139507075992100561077534028207257574257706278201308302642634678112591091843082665721697117838726431766741158743554298864560993255547608496686850185804659790217122426535133253371422250684486113457341827911625517128815447325958547912113242367201990672230681308819195941016156001961954700241576553750737681552256845421159386858399433450045903975167084252876848848085910156941603293424067793097271128806817514906531652407763118308162377033463203514657531210413149191213595455280387631030665594589183601575340027172997222489081631144728873621805528648768511368948639522975539046995395707688938978847084621586473529546678958226255042389998718141303055036060772003887773038422366913820397748550793178167220193346017430024134496141145991896227741842515718997898627269918236920453493946658273870473264523119133765447653295022886429174942653014656521909469613184983671431465934965489425515981067546087342348350724207583544436107294087637975025147846254526938442435644928231027868701394819091132912397475713787593612758364812687556725146456646878912169274219209708166678668152184941578590201953144030519381922273252666652671717526318606676754556170379350956342095455612780202199922615392785572481747913435560866995432578680971243966868110016581395696310922519803685837460795358384618017215468122880442252343684547233668502313239328352671318130604247460452134121833305284398726438573787798499612760939462427922917659263046333084007208056631996856315539698234022953452211505675629153637867252695056925345220084020071611220575700841268302638995272842160994219632684575364180160991884885091858259996299627148614456696661412745040519981575543804847463997422326563897043803732970397488471644906183310144691243649149542394691524972023935190633672827306116525712882959108434211652465621144702015336657459532134026915214509960877430595844287585350290234547564574848753110281101545931547225811763441710217452979668178025286460158324658852904105792472468108996135476637212057508192176910900422826969523438985332067597093454021924077101784215936539638808624420121459718286059401823614213214326004270471752802725625810953787713898846144256909835116371235019527013180204030167601567064268573820697948868982630904164685161783088076506964317303709708574052747204405282785965604677674192569851918643651835755242670293612851920696732320545562286110332140065912751551110134916256237884844001366366654055079721985816714803952429301558096968202261698837096090377863017797020488044826628817462866854321356787305635653577619877987998113667928954840972022833505708587561902023411398915823487627297968947621416912816367516125096563705174220460639857683971213093125 |
F[SUB]4901[/SUB]= | 7923915999344758879681538385654060210914626781351224002496129774965671474421263174829192808698240026465636962465795614832022116861815577337899985495645063394201223539434624769421026098088208676821572873654091991562623822756661775645412547205812699442900273377247217317134525912963675548628641390552344567343375974977198055098019421970270437077808839553772413472526578037309410513855511224567917484642458470894873920539716222184258151044127051048279928985410678642844378050865287922097947875703404093638032511260587162047158378383729865559753344029495676500353505238192071266013653756479643030868465669091621050336050452176067832538735547818846076217843538297479083165449288171596118631300511788907962975164356815036989144575133853217859400918131892718021604251640323071740968052143355339856841623665026186923990360006115205117668959704186791935988146115897256240752912449283411855808516138100800926482658655628467426982250915421085987936183036000218133134512985238518041585934034646591058882412345936566699923525150884920901 |
Function FIBO91(N&)
Dim i&, j%, Tmp&, Retenue&, Drapeau As Boolean 'Français, je laisse le flag aux impérialistes étasuniens et à leurs valets.
Dim NbTranches%, Tranche&(), Fibonacci$
NbTranches = Int(N * 2.32208489166643E-02 - 3.88316669075566E-02)
NbTranches = NbTranches - (NbTranches < 0)
ReDim Tranche(2, NbTranches)
Tranche(1, NbTranches) = 1
For i = 2 To N
For j = NbTranches To 0 Step -1
Tmp = Tranche(1, j) + Tranche(2, j) + Retenue
If Tmp > 999999999# Then
Tranche(0, j) = Tmp - 1000000000#: Retenue = 1
Else
Tranche(0, j) = Tmp: Retenue = 0
End If
Next
For j = 0 To NbTranches
Tranche(2, j) = Tranche(1, j): Tranche(1, j) = Tranche(0, j)
Next
Next
Drapeau = False
For j = 0 To NbTranches
If Drapeau Then
Fibonacci = Fibonacci & Right$("000000000" & Tranche(0, j), 9)
ElseIf Tranche(0, j) Then
Fibonacci = Fibonacci & Tranche(0, j): Drapeau = True
End If
Next
FIBO91 = Fibonacci
End Function
Function FIBO92(N&) 'N >= 0
Const l% = 180 'Nombre maximum de chiffres par cellule.
Dim f$, d%, k%
d = CInt(Application.Caller.Count)
ReDim fib$(d - 1, 0)
If N < 2 Then
fib(0, 0) = CStr(N)
ElseIf Int(0.208987640249977 * N + 0.650514997831991) > d * l Then
fib(0, 0) = "Dépassement de capacité"
Else
f = FIBO91(N)
Do While Len(f) > l
fib(k, 0) = Left$(f, l)
f = Right$(f, Len(f) - l)
k = k + 1
Loop
fib(k, 0) = f
End If
FIBO92 = fib
End Function
(...)
Avec ce nombre:
12345689, saisi sous Excel 2003
j'ai Dépassement de capacité qui s'affiche (en B1)
Avec ce nombre :
12345678910, #NOMBRE s'affiche en B1:B150
Donc cela fonctionne aussi sous Excel 2003.
(...)