Skip to content

Instantly share code, notes, and snippets.

@Riduidel
Created April 8, 2010 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Riduidel/359940 to your computer and use it in GitHub Desktop.
Save Riduidel/359940 to your computer and use it in GitHub Desktop.
def getPascal(upto) {
def returned = []
for(i in 0..(upto)) {
returned[i]=[]
for(j in 0..i) {
if(i>0)
returned[i][j] = (j>0 ? returned[i-1][j-1] : 0G)+(j<returned[i-1].size() ? returned[i-1][j] : 0G)
else
returned[i][j]=1G
}
}
return returned
}
println getPascal(2*20)[2*20][20]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment