Last active
May 25, 2020 20:18
-
-
Save Quantalabs/df5449b368dfb04ecd21b6a957c6eaf2 to your computer and use it in GitHub Desktop.
Outputs numbers in the Padovan Sequence. Modify the variable "amount" to change amount of numbers outputede. Read more on the Pardovan Sequence at https://en.wikipedia.org/wiki/Padovan_sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var list = [1,1,1] //changing these values to [3,0,2] will output the perrin sequence | |
var amount = 7 //changing this value will change the amount of numbers outputed. | |
for(var i = 0; i < amount-3; i++) { //chaning the number that is subtracted from 'amount' is the original length of list | |
var j = list[i]; | |
var e = list[i+1]; | |
list.push(j+e) | |
} | |
console.log(list) //change to 'document.body.innerHTML = list' to show on webpage or append to a div or paragraph if needed |
Fixed. Updating soon!
Updated
Missed Semicolons in For Loop. Just updated that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This version doesn't work. Will Fix