13 lines
No EOL
329 B
Text
13 lines
No EOL
329 B
Text
// a function to sum the N first powers of a field element
|
|
def sum_powers<N>(field a) -> field {
|
|
field res = 0;
|
|
for u32 i in 0..N {
|
|
res = res + a ** i;
|
|
}
|
|
return res;
|
|
}
|
|
|
|
def main(field a) -> field {
|
|
// call `sum_powers` providing the explicit generic parameter `N := 5`
|
|
return sum_powers::<5>(a);
|
|
} |