CINXE.COM

Rekursion – Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available" lang="sv" dir="ltr"> <head> <meta charset="UTF-8"> <title>Rekursion – Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-disabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )svwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":[",\t."," \t,"],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmy","wgMonthNames":["","januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],"wgRequestId":"e58bc127-6104-496d-8850-83075e69ee2b","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Rekursion","wgTitle":"Rekursion","wgCurRevisionId":55136412,"wgRevisionId":55136412,"wgArticleId":19546,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Funktioner","Juridiska termer","Programmering","World Wide Web","Rekursion","Självreferens"],"wgPageViewLanguage":"sv","wgPageContentLanguage":"sv","wgPageContentModel":"wikitext","wgRelevantPageName":"Rekursion","wgRelevantArticleId":19546,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true, "wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"sv","pageLanguageDir":"ltr","pageVariantFallbacks":"sv"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":true,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":3000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q179976","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.gadget.babel":"ready","ext.gadget.geo":"ready","ext.gadget.warnings":"ready", "ext.gadget.tags":"ready","ext.gadget.error":"ready","ext.gadget.referenser":"ready","ext.gadget.printonly":"ready","ext.gadget.tables":"ready","ext.gadget.toccolours":"ready","ext.gadget.smallTagFontSize":"ready","ext.gadget.videoPlayButton":"ready","ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.math.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.page.media","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.editsection0","ext.gadget.ProtectionIndicators","ext.gadget.GeoboxLocatorMulti","ext.gadget.InterwikiBadges", "ext.gadget.collapsibleTables","ext.gadget.NewSection","ext.gadget.ExkluderaRobotskapadeSidor","ext.gadget.Nearby","ext.gadget.InterProjectLinks","ext.gadget.cgiircbox","ext.gadget.withJS","ext.gadget.CommonsFileLinks","ext.gadget.tableSorterCollation","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=sv&amp;modules=ext.math.styles%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=sv&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=sv&amp;modules=ext.gadget.babel%2Cerror%2Cgeo%2Cprintonly%2Creferenser%2CsmallTagFontSize%2Ctables%2Ctags%2Ctoccolours%2CvideoPlayButton%2Cwarnings&amp;only=styles&amp;skin=vector-2022"> <link rel="stylesheet" href="/w/load.php?lang=sv&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/1200px-Droste_1260359-nevit%2C_corrected.jpg"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="949"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/800px-Droste_1260359-nevit%2C_corrected.jpg"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="632"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/640px-Droste_1260359-nevit%2C_corrected.jpg"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="506"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Rekursion – Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//sv.m.wikipedia.org/wiki/Rekursion"> <link rel="alternate" type="application/x-wiki" title="Redigera" href="/w/index.php?title=Rekursion&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (sv)"> <link rel="EditURI" type="application/rsd+xml" href="//sv.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://sv.wikipedia.org/wiki/Rekursion"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.sv"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom-flöde" href="/w/index.php?title=Special:Senaste_%C3%A4ndringar&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Rekursion rootpage-Rekursion skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Hoppa till innehållet</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Webbplats"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Huvudmeny" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Huvudmeny</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Huvudmeny</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">flytta till sidofältet</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">dölj</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigering </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Portal:Huvudsida" title="Besök huvudsidan [z]" accesskey="z"><span>Huvudsida</span></a></li><li id="n-Introduktion" class="mw-list-item"><a href="/wiki/Wikipedia:Introduktion"><span>Introduktion</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Deltagarportalen" title="Om projektet, vad du kan göra, var man kan hitta saker"><span>Deltagarportalen</span></a></li><li id="n-Bybrunnen" class="mw-list-item"><a href="/wiki/Wikipedia:Bybrunnen"><span>Bybrunnen</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:Senaste_%C3%A4ndringar" title="Lista över de senaste ändringarna på wikin [r]" accesskey="r"><span>Senaste ändringarna</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Slumpsida" title="Gå till en slumpmässigt vald sida [x]" accesskey="x"><span>Slumpartikel</span></a></li><li id="n-filuppladdning" class="mw-list-item"><a href="//commons.wikimedia.org/wiki/Special:UploadWizard" title="Ladda upp filer till Wikimedia Commons"><span>Ladda upp filer</span></a></li><li id="n-Kontakta-Wikipedia" class="mw-list-item"><a href="/wiki/Wikipedia:Kontakt"><span>Kontakta Wikipedia</span></a></li><li id="n-help" class="mw-list-item"><a href="/wiki/Wikipedia:Hj%C3%A4lp" title="Platsen där du hittar hjälp"><span>Hjälp</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Portal:Huvudsida" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="" src="/static/images/mobile/copyright/wikipedia-tagline-sv.svg" width="120" height="13" style="width: 7.5em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:S%C3%B6k" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Sök i svenskspråkiga Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Sök</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Sök på Wikipedia" aria-label="Sök på Wikipedia" autocapitalize="sentences" title="Sök i svenskspråkiga Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Sök"> </div> <button class="cdx-button cdx-search-input__end-button">Sök</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personliga verktyg"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Utseende"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Ändra utseendet på sidans teckenstorlek, bredd och färg" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Utseende" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Utseende</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="//donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_sv.wikipedia.org&amp;uselang=sv" class=""><span>Stöd Wikipedia</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:Skapa_konto&amp;returnto=Rekursion" title="Du uppmuntras att skapa ett konto och logga in, men det är inte obligatoriskt" class=""><span>Skapa konto</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:Inloggning&amp;returnto=Rekursion" title="Inloggning ger tillgång till fler funktioner för den som vill skriva och redigera artiklar. [o]" accesskey="o" class=""><span>Logga in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Fler alternativ" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personliga verktyg" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personliga verktyg</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="Användarmeny" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="//donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_sv.wikipedia.org&amp;uselang=sv"><span>Stöd Wikipedia</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:Skapa_konto&amp;returnto=Rekursion" title="Du uppmuntras att skapa ett konto och logga in, men det är inte obligatoriskt"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Skapa konto</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:Inloggning&amp;returnto=Rekursion" title="Inloggning ger tillgång till fler funktioner för den som vill skriva och redigera artiklar. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Logga in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Sidor för utloggade redigerare <a href="/wiki/Hj%C3%A4lp:Introduktion" aria-label="Läs mer om redigering"><span>läs mer</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:Mina_bidrag" title="En lista över redigeringar från denna IP-adress [y]" accesskey="y"><span>Bidrag</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:Min_diskussion" title="Diskussion om redigeringar från det här IP-numret [n]" accesskey="n"><span>Diskussion</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Webbplats"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Innehåll" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Innehåll</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">flytta till sidofältet</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">dölj</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">Inledning</div> </a> </li> <li id="toc-Exempel" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Exempel"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Exempel</span> </div> </a> <ul id="toc-Exempel-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Se_även" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Se_även"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Se även</span> </div> </a> <ul id="toc-Se_även-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Källor" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Källor"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Källor</span> </div> </a> <ul id="toc-Källor-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Externa_länkar" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Externa_länkar"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Externa länkar</span> </div> </a> <ul id="toc-Externa_länkar-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Innehåll" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Växla innehållsförteckningen" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Växla innehållsförteckningen</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Rekursion</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Gå till en artikel på ett annat språk. Tillgänglig på 61 språk" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-61" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">61 språk</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%B9%D9%88%D8%AF%D9%8A%D8%A9" title="عودية – arabiska" lang="ar" hreflang="ar" data-title="عودية" data-language-autonym="العربية" data-language-local-name="arabiska" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-az mw-list-item"><a href="https://az.wikipedia.org/wiki/Rekursiya" title="Rekursiya – azerbajdzjanska" lang="az" hreflang="az" data-title="Rekursiya" data-language-autonym="Azərbaycanca" data-language-local-name="azerbajdzjanska" class="interlanguage-link-target"><span>Azərbaycanca</span></a></li><li class="interlanguage-link interwiki-bn mw-list-item"><a href="https://bn.wikipedia.org/wiki/%E0%A6%AA%E0%A7%81%E0%A6%A8%E0%A6%B0%E0%A6%BE%E0%A6%AC%E0%A7%83%E0%A6%A4%E0%A7%8D%E0%A6%A4%E0%A6%BF_(%E0%A6%B0%E0%A6%BF%E0%A6%95%E0%A6%BE%E0%A6%B0%E0%A7%8D%E0%A6%B6%E0%A6%A8)" title="পুনরাবৃত্তি (রিকার্শন) – bengali" lang="bn" hreflang="bn" data-title="পুনরাবৃত্তি (রিকার্শন)" data-language-autonym="বাংলা" data-language-local-name="bengali" class="interlanguage-link-target"><span>বাংলা</span></a></li><li class="interlanguage-link interwiki-zh-min-nan mw-list-item"><a href="https://zh-min-nan.wikipedia.org/wiki/Ch%C3%A0i-kui" title="Chài-kui – min nan" lang="nan" hreflang="nan" data-title="Chài-kui" data-language-autonym="閩南語 / Bân-lâm-gú" data-language-local-name="min nan" class="interlanguage-link-target"><span>閩南語 / Bân-lâm-gú</span></a></li><li class="interlanguage-link interwiki-bg mw-list-item"><a href="https://bg.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D1%8F" title="Рекурсия – bulgariska" lang="bg" hreflang="bg" data-title="Рекурсия" data-language-autonym="Български" data-language-local-name="bulgariska" class="interlanguage-link-target"><span>Български</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Recursivitat" title="Recursivitat – katalanska" lang="ca" hreflang="ca" data-title="Recursivitat" data-language-autonym="Català" data-language-local-name="katalanska" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Rekurze" title="Rekurze – tjeckiska" lang="cs" hreflang="cs" data-title="Rekurze" data-language-autonym="Čeština" data-language-local-name="tjeckiska" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-da mw-list-item"><a href="https://da.wikipedia.org/wiki/Rekursion" title="Rekursion – danska" lang="da" hreflang="da" data-title="Rekursion" data-language-autonym="Dansk" data-language-local-name="danska" class="interlanguage-link-target"><span>Dansk</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Rekursion" title="Rekursion – tyska" lang="de" hreflang="de" data-title="Rekursion" data-language-autonym="Deutsch" data-language-local-name="tyska" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-et mw-list-item"><a href="https://et.wikipedia.org/wiki/Rekursioon" title="Rekursioon – estniska" lang="et" hreflang="et" data-title="Rekursioon" data-language-autonym="Eesti" data-language-local-name="estniska" class="interlanguage-link-target"><span>Eesti</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%91%CE%BD%CE%B1%CE%B4%CF%81%CE%BF%CE%BC%CE%AE" title="Αναδρομή – grekiska" lang="el" hreflang="el" data-title="Αναδρομή" data-language-autonym="Ελληνικά" data-language-local-name="grekiska" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-en mw-list-item"><a href="https://en.wikipedia.org/wiki/Recursion" title="Recursion – engelska" lang="en" hreflang="en" data-title="Recursion" data-language-autonym="English" data-language-local-name="engelska" class="interlanguage-link-target"><span>English</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Recursi%C3%B3n" title="Recursión – spanska" lang="es" hreflang="es" data-title="Recursión" data-language-autonym="Español" data-language-local-name="spanska" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Rikuro" title="Rikuro – esperanto" lang="eo" hreflang="eo" data-title="Rikuro" data-language-autonym="Esperanto" data-language-local-name="esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-eu mw-list-item"><a href="https://eu.wikipedia.org/wiki/Errekurtsio" title="Errekurtsio – baskiska" lang="eu" hreflang="eu" data-title="Errekurtsio" data-language-autonym="Euskara" data-language-local-name="baskiska" class="interlanguage-link-target"><span>Euskara</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%A8%D8%A7%D8%B2%DA%AF%D8%B4%D8%AA" title="بازگشت – persiska" lang="fa" hreflang="fa" data-title="بازگشت" data-language-autonym="فارسی" data-language-local-name="persiska" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/R%C3%A9cursivit%C3%A9" title="Récursivité – franska" lang="fr" hreflang="fr" data-title="Récursivité" data-language-autonym="Français" data-language-local-name="franska" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-gl mw-list-item"><a href="https://gl.wikipedia.org/wiki/Recursividade" title="Recursividade – galiciska" lang="gl" hreflang="gl" data-title="Recursividade" data-language-autonym="Galego" data-language-local-name="galiciska" class="interlanguage-link-target"><span>Galego</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%9E%AC%EA%B7%80" title="재귀 – koreanska" lang="ko" hreflang="ko" data-title="재귀" data-language-autonym="한국어" data-language-local-name="koreanska" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hy mw-list-item"><a href="https://hy.wikipedia.org/wiki/%D5%8C%D5%A5%D5%AF%D5%B8%D6%82%D6%80%D5%BD%D5%AB%D5%A1" title="Ռեկուրսիա – armeniska" lang="hy" hreflang="hy" data-title="Ռեկուրսիա" data-language-autonym="Հայերեն" data-language-local-name="armeniska" class="interlanguage-link-target"><span>Հայերեն</span></a></li><li class="interlanguage-link interwiki-hi mw-list-item"><a href="https://hi.wikipedia.org/wiki/%E0%A4%AA%E0%A5%8D%E0%A4%B0%E0%A4%A4%E0%A4%BF%E0%A4%B5%E0%A4%B0%E0%A5%8D%E0%A4%A4%E0%A4%A8" title="प्रतिवर्तन – hindi" lang="hi" hreflang="hi" data-title="प्रतिवर्तन" data-language-autonym="हिन्दी" data-language-local-name="hindi" class="interlanguage-link-target"><span>हिन्दी</span></a></li><li class="interlanguage-link interwiki-hr mw-list-item"><a href="https://hr.wikipedia.org/wiki/Rekurzija" title="Rekurzija – kroatiska" lang="hr" hreflang="hr" data-title="Rekurzija" data-language-autonym="Hrvatski" data-language-local-name="kroatiska" class="interlanguage-link-target"><span>Hrvatski</span></a></li><li class="interlanguage-link interwiki-io mw-list-item"><a href="https://io.wikipedia.org/wiki/Rekurso" title="Rekurso – ido" lang="io" hreflang="io" data-title="Rekurso" data-language-autonym="Ido" data-language-local-name="ido" class="interlanguage-link-target"><span>Ido</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Rekursi" title="Rekursi – indonesiska" lang="id" hreflang="id" data-title="Rekursi" data-language-autonym="Bahasa Indonesia" data-language-local-name="indonesiska" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-ia mw-list-item"><a href="https://ia.wikipedia.org/wiki/Recursion" title="Recursion – interlingua" lang="ia" hreflang="ia" data-title="Recursion" data-language-autonym="Interlingua" data-language-local-name="interlingua" class="interlanguage-link-target"><span>Interlingua</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/Endurkv%C3%A6mt_fall" title="Endurkvæmt fall – isländska" lang="is" hreflang="is" data-title="Endurkvæmt fall" data-language-autonym="Íslenska" data-language-local-name="isländska" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%A8%D7%A7%D7%95%D7%A8%D7%A1%D7%99%D7%94" title="רקורסיה – hebreiska" lang="he" hreflang="he" data-title="רקורסיה" data-language-autonym="עברית" data-language-local-name="hebreiska" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-kk mw-list-item"><a href="https://kk.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D1%8F" title="Рекурсия – kazakiska" lang="kk" hreflang="kk" data-title="Рекурсия" data-language-autonym="Қазақша" data-language-local-name="kazakiska" class="interlanguage-link-target"><span>Қазақша</span></a></li><li class="interlanguage-link interwiki-lv mw-list-item"><a href="https://lv.wikipedia.org/wiki/Rekursija" title="Rekursija – lettiska" lang="lv" hreflang="lv" data-title="Rekursija" data-language-autonym="Latviešu" data-language-local-name="lettiska" class="interlanguage-link-target"><span>Latviešu</span></a></li><li class="interlanguage-link interwiki-lt mw-list-item"><a href="https://lt.wikipedia.org/wiki/Rekursija" title="Rekursija – litauiska" lang="lt" hreflang="lt" data-title="Rekursija" data-language-autonym="Lietuvių" data-language-local-name="litauiska" class="interlanguage-link-target"><span>Lietuvių</span></a></li><li class="interlanguage-link interwiki-lmo mw-list-item"><a href="https://lmo.wikipedia.org/wiki/Recorsion" title="Recorsion – lombardiska" lang="lmo" hreflang="lmo" data-title="Recorsion" data-language-autonym="Lombard" data-language-local-name="lombardiska" class="interlanguage-link-target"><span>Lombard</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/Rekurzi%C3%B3" title="Rekurzió – ungerska" lang="hu" hreflang="hu" data-title="Rekurzió" data-language-autonym="Magyar" data-language-local-name="ungerska" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%B8%E0%B5%8D%E0%B4%B5%E0%B4%BE%E0%B4%B5%E0%B5%BC%E0%B4%A4%E0%B5%8D%E0%B4%A4%E0%B4%A8%E0%B4%82" title="സ്വാവർത്തനം – malayalam" lang="ml" hreflang="ml" data-title="സ്വാവർത്തനം" data-language-autonym="മലയാളം" data-language-local-name="malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-mr mw-list-item"><a href="https://mr.wikipedia.org/wiki/%E0%A4%B8%E0%A5%8D%E0%A4%B5%E0%A4%BE%E0%A4%B5%E0%A4%B0%E0%A5%8D%E0%A4%A4%E0%A4%A8" title="स्वावर्तन – marathi" lang="mr" hreflang="mr" data-title="स्वावर्तन" data-language-autonym="मराठी" data-language-local-name="marathi" class="interlanguage-link-target"><span>मराठी</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Recursie" title="Recursie – nederländska" lang="nl" hreflang="nl" data-title="Recursie" data-language-autonym="Nederlands" data-language-local-name="nederländska" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-nds-nl mw-list-item"><a href="https://nds-nl.wikipedia.org/wiki/Rekursie" title="Rekursie – lågsaxiska" lang="nds-NL" hreflang="nds-NL" data-title="Rekursie" data-language-autonym="Nedersaksies" data-language-local-name="lågsaxiska" class="interlanguage-link-target"><span>Nedersaksies</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E5%86%8D%E5%B8%B0" title="再帰 – japanska" lang="ja" hreflang="ja" data-title="再帰" data-language-autonym="日本語" data-language-local-name="japanska" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Rekursjon" title="Rekursjon – norskt bokmål" lang="nb" hreflang="nb" data-title="Rekursjon" data-language-autonym="Norsk bokmål" data-language-local-name="norskt bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-nn mw-list-item"><a href="https://nn.wikipedia.org/wiki/Rekursjon" title="Rekursjon – nynorska" lang="nn" hreflang="nn" data-title="Rekursjon" data-language-autonym="Norsk nynorsk" data-language-local-name="nynorska" class="interlanguage-link-target"><span>Norsk nynorsk</span></a></li><li class="interlanguage-link interwiki-uz mw-list-item"><a href="https://uz.wikipedia.org/wiki/Rekursiya" title="Rekursiya – uzbekiska" lang="uz" hreflang="uz" data-title="Rekursiya" data-language-autonym="Oʻzbekcha / ўзбекча" data-language-local-name="uzbekiska" class="interlanguage-link-target"><span>Oʻzbekcha / ўзбекча</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Rekurencja" title="Rekurencja – polska" lang="pl" hreflang="pl" data-title="Rekurencja" data-language-autonym="Polski" data-language-local-name="polska" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Recursividade" title="Recursividade – portugisiska" lang="pt" hreflang="pt" data-title="Recursividade" data-language-autonym="Português" data-language-local-name="portugisiska" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ro mw-list-item"><a href="https://ro.wikipedia.org/wiki/Recursivitate" title="Recursivitate – rumänska" lang="ro" hreflang="ro" data-title="Recursivitate" data-language-autonym="Română" data-language-local-name="rumänska" class="interlanguage-link-target"><span>Română</span></a></li><li class="interlanguage-link interwiki-rue mw-list-item"><a href="https://rue.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D0%B7%D1%96%D1%8F" title="Рекурзія – rusyn" lang="rue" hreflang="rue" data-title="Рекурзія" data-language-autonym="Русиньскый" data-language-local-name="rusyn" class="interlanguage-link-target"><span>Русиньскый</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D1%8F" title="Рекурсия – ryska" lang="ru" hreflang="ru" data-title="Рекурсия" data-language-autonym="Русский" data-language-local-name="ryska" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sa mw-list-item"><a href="https://sa.wikipedia.org/wiki/%E0%A4%AA%E0%A5%81%E0%A4%A8%E0%A4%B0%E0%A5%8D%E0%A4%97%E0%A4%AE%E0%A4%A8%E0%A4%B5%E0%A4%BE%E0%A4%A6" title="पुनर्गमनवाद – sanskrit" lang="sa" hreflang="sa" data-title="पुनर्गमनवाद" data-language-autonym="संस्कृतम्" data-language-local-name="sanskrit" class="interlanguage-link-target"><span>संस्कृतम्</span></a></li><li class="interlanguage-link interwiki-simple mw-list-item"><a href="https://simple.wikipedia.org/wiki/Recursion" title="Recursion – Simple English" lang="en-simple" hreflang="en-simple" data-title="Recursion" data-language-autonym="Simple English" data-language-local-name="Simple English" class="interlanguage-link-target"><span>Simple English</span></a></li><li class="interlanguage-link interwiki-sk mw-list-item"><a href="https://sk.wikipedia.org/wiki/Rekurzia_(matematika)" title="Rekurzia (matematika) – slovakiska" lang="sk" hreflang="sk" data-title="Rekurzia (matematika)" data-language-autonym="Slovenčina" data-language-local-name="slovakiska" class="interlanguage-link-target"><span>Slovenčina</span></a></li><li class="interlanguage-link interwiki-sl mw-list-item"><a href="https://sl.wikipedia.org/wiki/Rekurzija" title="Rekurzija – slovenska" lang="sl" hreflang="sl" data-title="Rekurzija" data-language-autonym="Slovenščina" data-language-local-name="slovenska" class="interlanguage-link-target"><span>Slovenščina</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D0%B7%D0%B8%D1%98%D0%B0" title="Рекурзија – serbiska" lang="sr" hreflang="sr" data-title="Рекурзија" data-language-autonym="Српски / srpski" data-language-local-name="serbiska" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-sh mw-list-item"><a href="https://sh.wikipedia.org/wiki/Rekurzija" title="Rekurzija – serbokroatiska" lang="sh" hreflang="sh" data-title="Rekurzija" data-language-autonym="Srpskohrvatski / српскохрватски" data-language-local-name="serbokroatiska" class="interlanguage-link-target"><span>Srpskohrvatski / српскохрватски</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Rekursio" title="Rekursio – finska" lang="fi" hreflang="fi" data-title="Rekursio" data-language-autonym="Suomi" data-language-local-name="finska" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-tl mw-list-item"><a href="https://tl.wikipedia.org/wiki/Rekursiyon" title="Rekursiyon – tagalog" lang="tl" hreflang="tl" data-title="Rekursiyon" data-language-autonym="Tagalog" data-language-local-name="tagalog" class="interlanguage-link-target"><span>Tagalog</span></a></li><li class="interlanguage-link interwiki-th mw-list-item"><a href="https://th.wikipedia.org/wiki/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%80%E0%B8%A7%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%81%E0%B8%B4%E0%B8%94" title="การเวียนเกิด – thailändska" lang="th" hreflang="th" data-title="การเวียนเกิด" data-language-autonym="ไทย" data-language-local-name="thailändska" class="interlanguage-link-target"><span>ไทย</span></a></li><li class="interlanguage-link interwiki-tg mw-list-item"><a href="https://tg.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D0%B8%D1%8F" title="Рекурсия – tadzjikiska" lang="tg" hreflang="tg" data-title="Рекурсия" data-language-autonym="Тоҷикӣ" data-language-local-name="tadzjikiska" class="interlanguage-link-target"><span>Тоҷикӣ</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/%C3%96zyineleme" title="Özyineleme – turkiska" lang="tr" hreflang="tr" data-title="Özyineleme" data-language-autonym="Türkçe" data-language-local-name="turkiska" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A0%D0%B5%D0%BA%D1%83%D1%80%D1%81%D1%96%D1%8F" title="Рекурсія – ukrainska" lang="uk" hreflang="uk" data-title="Рекурсія" data-language-autonym="Українська" data-language-local-name="ukrainska" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-vi mw-list-item"><a href="https://vi.wikipedia.org/wiki/%C4%90%E1%BB%87_quy" title="Đệ quy – vietnamesiska" lang="vi" hreflang="vi" data-title="Đệ quy" data-language-autonym="Tiếng Việt" data-language-local-name="vietnamesiska" class="interlanguage-link-target"><span>Tiếng Việt</span></a></li><li class="interlanguage-link interwiki-wuu mw-list-item"><a href="https://wuu.wikipedia.org/wiki/%E9%80%92%E5%BD%92" title="递归 – wu" lang="wuu" hreflang="wuu" data-title="递归" data-language-autonym="吴语" data-language-local-name="wu" class="interlanguage-link-target"><span>吴语</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E9%81%9E%E6%AD%B8" title="遞歸 – kantonesiska" lang="yue" hreflang="yue" data-title="遞歸" data-language-autonym="粵語" data-language-local-name="kantonesiska" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E9%80%92%E5%BD%92" title="递归 – kinesiska" lang="zh" hreflang="zh" data-title="递归" data-language-autonym="中文" data-language-local-name="kinesiska" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q179976#sitelinks-wikipedia" title="Redigera interwikilänkar" class="wbc-editpage">Redigera länkar</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namnrymder"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Rekursion" title="Visa innehållssidan [c]" accesskey="c"><span>Artikel</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Diskussion:Rekursion" rel="discussion" title="Diskussion om innehållssidan [t]" accesskey="t"><span>Diskussion</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Ändra språkvariant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">svenska</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Visningar"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Rekursion"><span>Läs</span></a></li><li id="ca-ve-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Rekursion&amp;veaction=edit" title="Redigera denna sida [v]" accesskey="v"><span>Redigera</span></a></li><li id="ca-edit" class="collapsible vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Rekursion&amp;action=edit" title="Redigera wikitexten för den här sidan [e]" accesskey="e"><span>Redigera wikitext</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Rekursion&amp;action=history" title="Tidigare versioner av sidan [h]" accesskey="h"><span>Visa historik</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Sidverktyg"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Verktyg" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Verktyg</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Verktyg</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">flytta till sidofältet</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">dölj</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="Fler alternativ" > <div class="vector-menu-heading"> Åtgärder </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Rekursion"><span>Läs</span></a></li><li id="ca-more-ve-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Rekursion&amp;veaction=edit" title="Redigera denna sida [v]" accesskey="v"><span>Redigera</span></a></li><li id="ca-more-edit" class="collapsible vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Rekursion&amp;action=edit" title="Redigera wikitexten för den här sidan [e]" accesskey="e"><span>Redigera wikitext</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Rekursion&amp;action=history"><span>Visa historik</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> Allmänt </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:L%C3%A4nkar_hit/Rekursion" title="Lista över alla wikisidor som länkar hit [j]" accesskey="j"><span>Sidor som länkar hit</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:Senaste_relaterade_%C3%A4ndringar/Rekursion" rel="nofollow" title="Visa senaste ändringarna av sidor som den här sidan länkar till [k]" accesskey="k"><span>Relaterade ändringar</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:Specialsidor" title="Lista över alla specialsidor [q]" accesskey="q"><span>Specialsidor</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Rekursion&amp;oldid=55136412" title="Permanent länk till den här versionen av sidan"><span>Permanent länk</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Rekursion&amp;action=info" title="Mer information om denna sida"><span>Sidinformation</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:Citera&amp;page=Rekursion&amp;id=55136412&amp;wpFormIdentifier=titleform" title="Information om hur den här artikeln kan användas som referens"><span>Använd som referens</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fsv.wikipedia.org%2Fwiki%2FRekursion"><span>Hämta förkortad url</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fsv.wikipedia.org%2Fwiki%2FRekursion"><span>Ladda ner QR-kod</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Skriv ut/exportera </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Special:Bok&amp;bookcmd=book_creator&amp;referer=Rekursion"><span>Skapa en bok</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Rekursion&amp;action=show-download-screen"><span>Ladda ned som PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Rekursion&amp;printable=yes" title="Utskriftsvänlig version av den här sidan [p]" accesskey="p"><span>Utskriftsvänlig version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> På andra projekt </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Category:Recursive_humor" hreflang="en"><span>Commons</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q179976" title="Länk till anslutet databasobjekt [g]" accesskey="g"><span>Wikidata-objekt</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Sidverktyg"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Utseende"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Utseende</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">flytta till sidofältet</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">dölj</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">Från Wikipedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="sv" dir="ltr"><figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/Fil:Droste_1260359-nevit,_corrected.jpg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/250px-Droste_1260359-nevit%2C_corrected.jpg" decoding="async" width="250" height="198" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/375px-Droste_1260359-nevit%2C_corrected.jpg 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/6/69/Droste_1260359-nevit%2C_corrected.jpg/500px-Droste_1260359-nevit%2C_corrected.jpg 2x" data-file-width="2697" data-file-height="2132" /></a><figcaption>Spegel i spegeleffekt kallas <a href="/wiki/Drosteeffekten" title="Drosteeffekten">drosteeffekten</a> och är ett exempel på rekursion.</figcaption></figure> <p><b>Rekursion</b> uppstår när någonting definieras i termer av sig själv. Rekursion används inom en mängd olika discipliner, från <a href="/wiki/Lingvistik" class="mw-redirect" title="Lingvistik">lingvistik</a> till <a href="/wiki/Logik" title="Logik">logik</a>. Det vanligaste användningsområdet av rekursion är inom <a href="/wiki/Matematik" title="Matematik">matematik</a> och <a href="/wiki/Datavetenskap" title="Datavetenskap">datavetenskap</a>, där en funktion definieras som tillämpad på sig själv. Även om detta tydligen definierar ett oändligt antal instanser (funktionsvärden), görs det ofta på ett sådant sätt att ingen slinga eller oändlig kedja av referenser kan förekomma. </p><p><a href="/wiki/R%C3%A4nta_p%C3%A5_r%C3%A4nta" class="mw-redirect" title="Ränta på ränta">Sammansatt ränta</a> är exempel på ett rekursivt samband. Om <i>A</i><sub>k</sub> representerar värdet av en investering efter <i>k</i> år och den fasta räntan är <i>r</i>, kan sambandet mellan två konsekutiva år skrivas </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle A_{k}=A_{k-1}+rA_{k-1}=(1+r)A_{k-1}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> </mrow> </msub> <mo>=</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> </mrow> </msub> <mo>+</mo> <mi>r</mi> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mo stretchy="false">(</mo> <mn>1</mn> <mo>+</mo> <mi>r</mi> <mo stretchy="false">)</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mi>k</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> </mrow> </msub> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle A_{k}=A_{k-1}+rA_{k-1}=(1+r)A_{k-1}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/088298516bd7ee3d21f122e98fa38fd8de444070" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:34.576ex; height:2.843ex;" alt="{\displaystyle A_{k}=A_{k-1}+rA_{k-1}=(1+r)A_{k-1}}"></span></dd></dl> <p>Om <i>A</i><sub>0</sub> är det initiala värdet kan värdet efter tre år bestämmas som </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle A_{3}=(1+r)A_{2}=(1+r)^{2}A_{1}=(1+r)^{3}A_{0}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>3</mn> </mrow> </msub> <mo>=</mo> <mo stretchy="false">(</mo> <mn>1</mn> <mo>+</mo> <mi>r</mi> <mo stretchy="false">)</mo> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msub> <mo>=</mo> <mo stretchy="false">(</mo> <mn>1</mn> <mo>+</mo> <mi>r</mi> <msup> <mo stretchy="false">)</mo> <mrow class="MJX-TeXAtom-ORD"> <mn>2</mn> </mrow> </msup> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mo stretchy="false">(</mo> <mn>1</mn> <mo>+</mo> <mi>r</mi> <msup> <mo stretchy="false">)</mo> <mrow class="MJX-TeXAtom-ORD"> <mn>3</mn> </mrow> </msup> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>0</mn> </mrow> </msub> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle A_{3}=(1+r)A_{2}=(1+r)^{2}A_{1}=(1+r)^{3}A_{0}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/9e3ff1404f196ef3f6d031c1b70a0fd62cba28f6" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:43.176ex; height:3.176ex;" alt="{\displaystyle A_{3}=(1+r)A_{2}=(1+r)^{2}A_{1}=(1+r)^{3}A_{0}}"></span></dd></dl> <p>En rekursiv funktion som beräknar sammansatt ränta kan definieras enligt </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle F(n):={\begin{cases}A_{0}&amp;{\text{om}}\ n=0&amp;{\text{basfall, sista anropet i anropskedjan}}\\(1\ +\ r)\cdot F(n\ -\ 1)&amp;{\text{om}}\ n\ &gt;\ 0\end{cases}}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> <mo>:=</mo> <mrow class="MJX-TeXAtom-ORD"> <mrow> <mo>{</mo> <mtable columnalign="left left" rowspacing=".2em" columnspacing="1em" displaystyle="false"> <mtr> <mtd> <msub> <mi>A</mi> <mrow class="MJX-TeXAtom-ORD"> <mn>0</mn> </mrow> </msub> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>basfall, sista anropet i anropskedjan</mtext> </mrow> </mtd> </mtr> <mtr> <mtd> <mo stretchy="false">(</mo> <mn>1</mn> <mtext>&#xA0;</mtext> <mo>+</mo> <mtext>&#xA0;</mtext> <mi>r</mi> <mo stretchy="false">)</mo> <mo>&#x22C5;<!-- ⋅ --></mo> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mtext>&#xA0;</mtext> <mo>&#x2212;<!-- − --></mo> <mtext>&#xA0;</mtext> <mn>1</mn> <mo stretchy="false">)</mo> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mtext>&#xA0;</mtext> <mo>&gt;</mo> <mtext>&#xA0;</mtext> <mn>0</mn> </mtd> </mtr> </mtable> <mo fence="true" stretchy="true" symmetric="true"></mo> </mrow> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle F(n):={\begin{cases}A_{0}&amp;{\text{om}}\ n=0&amp;{\text{basfall, sista anropet i anropskedjan}}\\(1\ +\ r)\cdot F(n\ -\ 1)&amp;{\text{om}}\ n\ &gt;\ 0\end{cases}}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/cb28f256a92bf9f1e8ec04f764ef0cd6fd0e6cd2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.505ex; width:82.054ex; height:6.176ex;" alt="{\displaystyle F(n):={\begin{cases}A_{0}&amp;{\text{om}}\ n=0&amp;{\text{basfall, sista anropet i anropskedjan}}\\(1\ +\ r)\cdot F(n\ -\ 1)&amp;{\text{om}}\ n\ &gt;\ 0\end{cases}}}"></span></dd></dl> <p>där <i>n</i> betecknar antalet år och <i>r</i> den fasta räntesatsen. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Exempel">Exempel</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Rekursion&amp;veaction=edit&amp;section=1" title="Redigera avsnitt: Exempel" class="mw-editsection-visualeditor"><span>redigera</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Rekursion&amp;action=edit&amp;section=1" title="Redigera avsnitts källkod: Exempel"><span>redigera wikitext</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li>Ett klassiskt exempel på en rekursiv funktion är beräkningen av <a href="/wiki/Fibonaccital" title="Fibonaccital">fibonaccital</a>:</li></ul> <dl><dd><dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall 1}}\\1&amp;{\text{om}}\ n=1&amp;{\text{basfall 2}}\\F(n-1)+F(n-2)&amp;{\text{om}}\ n&gt;1&amp;\\\end{cases}}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> <mo>:=</mo> <mrow class="MJX-TeXAtom-ORD"> <mrow> <mo>{</mo> <mtable columnalign="left left" rowspacing=".2em" columnspacing="1em" displaystyle="false"> <mtr> <mtd> <mn>1</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>basfall 1</mtext> </mrow> </mtd> </mtr> <mtr> <mtd> <mn>1</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>=</mo> <mn>1</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>basfall 2</mtext> </mrow> </mtd> </mtr> <mtr> <mtd> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> <mo stretchy="false">)</mo> <mo>+</mo> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo>&#x2212;<!-- − --></mo> <mn>2</mn> <mo stretchy="false">)</mo> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>&gt;</mo> <mn>1</mn> </mtd> <mtd /> </mtr> </mtable> <mo fence="true" stretchy="true" symmetric="true"></mo> </mrow> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall 1}}\\1&amp;{\text{om}}\ n=1&amp;{\text{basfall 2}}\\F(n-1)+F(n-2)&amp;{\text{om}}\ n&gt;1&amp;\\\end{cases}}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/704f9916ffb3bd58ee43d0e40df83036a3a79565" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.671ex; width:54.505ex; height:8.509ex;" alt="{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall 1}}\\1&amp;{\text{om}}\ n=1&amp;{\text{basfall 2}}\\F(n-1)+F(n-2)&amp;{\text{om}}\ n&gt;1&amp;\\\end{cases}}}"></span></dd></dl></dd></dl> <ul><li>Beräkning av <a href="/wiki/Fakultet_(matematik)" title="Fakultet (matematik)">fakultet</a>, (<i>n</i>!):</li></ul> <dl><dd><dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall}}\\n\cdot F(n-1)&amp;{\text{om}}\ n&gt;0&amp;\\\end{cases}}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo stretchy="false">)</mo> <mo>:=</mo> <mrow class="MJX-TeXAtom-ORD"> <mrow> <mo>{</mo> <mtable columnalign="left left" rowspacing=".2em" columnspacing="1em" displaystyle="false"> <mtr> <mtd> <mn>1</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>basfall</mtext> </mrow> </mtd> </mtr> <mtr> <mtd> <mi>n</mi> <mo>&#x22C5;<!-- ⋅ --></mo> <mi>F</mi> <mo stretchy="false">(</mo> <mi>n</mi> <mo>&#x2212;<!-- − --></mo> <mn>1</mn> <mo stretchy="false">)</mo> </mtd> <mtd> <mrow class="MJX-TeXAtom-ORD"> <mtext>om</mtext> </mrow> <mtext>&#xA0;</mtext> <mi>n</mi> <mo>&gt;</mo> <mn>0</mn> </mtd> <mtd /> </mtr> </mtable> <mo fence="true" stretchy="true" symmetric="true"></mo> </mrow> </mrow> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall}}\\n\cdot F(n-1)&amp;{\text{om}}\ n&gt;0&amp;\\\end{cases}}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b93b11217f58314ef4b207d5f663c1fc7e9025f2" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.505ex; width:43.725ex; height:6.176ex;" alt="{\displaystyle F(n):={\begin{cases}1&amp;{\text{om}}\ n=0&amp;{\text{basfall}}\\n\cdot F(n-1)&amp;{\text{om}}\ n&gt;0&amp;\\\end{cases}}}"></span></dd></dl></dd></dl> <ul><li>En <a href="/wiki/Subrutin" class="mw-redirect" title="Subrutin">subrutin</a> i ett <a href="/wiki/Datorprogram" title="Datorprogram">datorprogram</a> som anropar sig själv, antingen direkt eller genom att anropa andra rutiner som till slut anropar den första igen.</li> <li>En <a href="/wiki/Domstol" title="Domstol">domstol</a> som dömer sig själv.</li> <li>En <a href="/wiki/Webbsida" title="Webbsida">webbsida</a> som via en <a href="/wiki/Hyperl%C3%A4nk" title="Hyperlänk">länk</a> refererar till sig själv. <a class="mw-selflink-fragment" href="#Rekursion">Denna länk</a> är ett exempel.</li></ul> <div class="mw-heading mw-heading2"><h2 id="Se_även"><span id="Se_.C3.A4ven"></span>Se även</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Rekursion&amp;veaction=edit&amp;section=2" title="Redigera avsnitt: Se även" class="mw-editsection-visualeditor"><span>redigera</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Rekursion&amp;action=edit&amp;section=2" title="Redigera avsnitts källkod: Se även"><span>redigera wikitext</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Rekursiv_funktion" title="Rekursiv funktion">Rekursiv funktion</a></li> <li><a href="/wiki/Rekursiv_algoritm" title="Rekursiv algoritm">Rekursiv algoritm</a></li> <li><a href="/wiki/O%C3%A4ndlig_slinga" title="Oändlig slinga">Oändlig slinga</a></li> <li><a href="/wiki/Sj%C3%A4lvreferens" title="Självreferens">Självreferens</a></li> <li><a href="/wiki/Generativ_grammatik" title="Generativ grammatik">Generativ grammatik</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Källor"><span id="K.C3.A4llor"></span>Källor</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Rekursion&amp;veaction=edit&amp;section=3" title="Redigera avsnitt: Källor" class="mw-editsection-visualeditor"><span>redigera</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Rekursion&amp;action=edit&amp;section=3" title="Redigera avsnitts källkod: Källor"><span>redigera wikitext</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><cite style="font-style:normal" class="journal" id="CITEREFDijkstra1960"><a href="/wiki/Edsger_Dijkstra" title="Edsger Dijkstra">Dijkstra, Edsger W.</a>&#32;(1960).&#32;”Recursive Programming”.&#32;<i>Numerische Mathematik</i>&#32;2&#32;(1): sid.&#160;312–318. <a href="/wiki/Digital_object_identifier" title="Digital object identifier">doi</a>:<span class="neverexpand"><a rel="nofollow" class="external text" href="https://dx.doi.org/10.1007%2FBF01386232">10.1007/BF01386232</a></span>.</cite><span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.atitle=Recursive+Programming&amp;rft.jtitle=Numerische+Mathematik&amp;rft.aulast=Dijkstra&amp;rft.aufirst=Edsger+W.&amp;rft.au=Dijkstra%2C+Edsger+W.&amp;rft.date=1960&amp;rft.volume=2&amp;rft.issue=1&amp;rft.pages=sid.%26nbsp%3B312%E2%80%93318&amp;rft_id=info:doi/10.1007%2FBF01386232&amp;rfr_id=info:sid/en.wikipedia.org:Rekursion"><span style="display: none;">&#160;</span></span></li></ul> <p><br /> </p> <div class="mw-heading mw-heading2"><h2 id="Externa_länkar"><span id="Externa_l.C3.A4nkar"></span>Externa länkar</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Rekursion&amp;veaction=edit&amp;section=4" title="Redigera avsnitt: Externa länkar" class="mw-editsection-visualeditor"><span>redigera</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Rekursion&amp;action=edit&amp;section=4" title="Redigera avsnitts källkod: Externa länkar"><span>redigera wikitext</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><span typeof="mw:File"><span><img src="//upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Commons-logo.svg/15px-Commons-logo.svg.png" decoding="async" width="15" height="20" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Commons-logo.svg/23px-Commons-logo.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Commons-logo.svg/30px-Commons-logo.svg.png 2x" data-file-width="1024" data-file-height="1376" /></span></span> Wikimedia Commons har media som rör <a href="https://commons.wikimedia.org/wiki/Category:Recursion" class="extiw" title="commons:Category:Recursion">Rekursion</a>.<div class="interProject commons" style="display:none;"><a href="https://commons.wikimedia.org/wiki/Category:Recursion" class="extiw" title="commons:Category:Recursion">Bilder &amp; media</a></div></li></ul> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐cb8c6c499‐tb67d Cached time: 20241104170430 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.073 seconds Real time usage: 0.148 seconds Preprocessor visited node count: 719/1000000 Post‐expand include size: 4321/2097152 bytes Template argument size: 885/2097152 bytes Highest expansion depth: 15/100 Expensive parser function count: 0/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 200/5000000 bytes Lua time usage: 0.020/10.000 seconds Lua memory usage: 648129/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 63.448 1 -total 68.25% 43.304 1 Mall:Commonscat 31.28% 19.849 1 Mall:Tidskriftsref 27.31% 17.329 1 Mall:Cite_journal 22.03% 13.978 1 Mall:Citation/core 4.38% 2.781 1 Mall:Link 2.57% 1.628 1 Mall:Iwcommonscat --> <!-- Saved in parser cache with key svwiki:pcache:idhash:19546-0!canonical and timestamp 20241104170430 and revision id 55136412. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Hämtad från ”<a dir="ltr" href="https://sv.wikipedia.org/w/index.php?title=Rekursion&amp;oldid=55136412">https://sv.wikipedia.org/w/index.php?title=Rekursion&amp;oldid=55136412</a>”</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Wikipedia:Kategorier" title="Wikipedia:Kategorier">Kategorier</a>: <ul><li><a href="/wiki/Kategori:Funktioner" title="Kategori:Funktioner">Funktioner</a></li><li><a href="/wiki/Kategori:Juridiska_termer" title="Kategori:Juridiska termer">Juridiska termer</a></li><li><a href="/wiki/Kategori:Programmering" title="Kategori:Programmering">Programmering</a></li><li><a href="/wiki/Kategori:World_Wide_Web" title="Kategori:World Wide Web">World Wide Web</a></li><li><a href="/wiki/Kategori:Rekursion" title="Kategori:Rekursion">Rekursion</a></li><li><a href="/wiki/Kategori:Sj%C3%A4lvreferens" title="Kategori:Självreferens">Självreferens</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> Sidan redigerades senast den 2 juli 2024 kl. 18.55.</li> <li id="footer-info-copyright">Wikipedias text är tillgänglig under licensen <a rel="nofollow" class="external text" href="//creativecommons.org/licenses/by-sa/4.0/deed.sv">Creative Commons Erkännande-dela-lika 4.0 Unported</a>. För bilder, se respektive bildsida (klicka på bilden). Se vidare <a href="/wiki/Wikipedia:Upphovsr%C3%A4tt" title="Wikipedia:Upphovsrätt">Wikipedia:Upphovsrätt</a> och <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">användarvillkor</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Wikimedias integritetspolicy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:Om">Om Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:Allm%C3%A4nt_f%C3%B6rbeh%C3%A5ll">Förbehåll</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Uppförandekod</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Utvecklare</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/sv.wikipedia.org">Statistik</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Information om kakor</a></li> <li id="footer-places-mobileview"><a href="//sv.m.wikipedia.org/w/index.php?title=Rekursion&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobilvy</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-694cf4987f-5j4m9","wgBackendResponseTime":145,"wgPageParseReport":{"limitreport":{"cputime":"0.073","walltime":"0.148","ppvisitednodes":{"value":719,"limit":1000000},"postexpandincludesize":{"value":4321,"limit":2097152},"templateargumentsize":{"value":885,"limit":2097152},"expansiondepth":{"value":15,"limit":100},"expensivefunctioncount":{"value":0,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":200,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 63.448 1 -total"," 68.25% 43.304 1 Mall:Commonscat"," 31.28% 19.849 1 Mall:Tidskriftsref"," 27.31% 17.329 1 Mall:Cite_journal"," 22.03% 13.978 1 Mall:Citation/core"," 4.38% 2.781 1 Mall:Link"," 2.57% 1.628 1 Mall:Iwcommonscat"]},"scribunto":{"limitreport-timeusage":{"value":"0.020","limit":"10.000"},"limitreport-memusage":{"value":648129,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-cb8c6c499-tb67d","timestamp":"20241104170430","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Rekursion","url":"https:\/\/sv.wikipedia.org\/wiki\/Rekursion","sameAs":"http:\/\/www.wikidata.org\/entity\/Q179976","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q179976","author":{"@type":"Organization","name":"Bidragsgivare till Wikimedia-projekten"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2003-09-30T14:02:41Z","dateModified":"2024-07-02T17:55:37Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/69\/Droste_1260359-nevit%2C_corrected.jpg","headline":"process som definieras av sig sj\u00e4lv"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10