Skip to content

Instantly share code, notes, and snippets.

@na2hiro
Created November 11, 2012 05:37
Show Gist options
  • Save na2hiro/4053847 to your computer and use it in GitHub Desktop.
Save na2hiro/4053847 to your computer and use it in GitHub Desktop.
逆パスカル数
function pascal(arr){
console.log(arr);
if(arr.length==1) return arr;
var newarr = [];
for(var i=0; i<arr.length-1; i++){
newarr.push((Number(arr[i])+Number(arr[i+1]))%10)
}
return pascal(newarr);
}
@na2hiro
Copy link
Author

na2hiro commented Nov 11, 2012

gistおためし

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment