Skip to content

Instantly share code, notes, and snippets.

@hrgnz
Created November 30, 2020 17:04
Show Gist options
  • Save hrgnz/10c4c3afb5a332c8ad3428327e6459c0 to your computer and use it in GitHub Desktop.
Save hrgnz/10c4c3afb5a332c8ad3428327e6459c0 to your computer and use it in GitHub Desktop.
pe709a.nb
In[]:= ClearAll["Global`*"];
AbsoluteTiming[
nmax = 24680;
modnum = 1020202009;
dp[0] = 1; dp[1] = 1;
Do[dp[n + 1] =
Mod[PowerMod[n + 1, -1, modnum]*Sum[dp[2 k]*dp[n - 2 k],
{k, 0, Quotient[n, 2]}], modnum], {n, nmax - 1}];
ans = Mod[dp[nmax]*Mod[nmax!, modnum], modnum]]
Out[]= {215.379, ???}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment