Skip to content

Instantly share code, notes, and snippets.

@asukaminato0721
Last active January 2, 2022 02:45
Show Gist options
  • Save asukaminato0721/999936f6f9e2db092ff7672f599e8046 to your computer and use it in GitHub Desktop.
Save asukaminato0721/999936f6f9e2db092ff7672f599e8046 to your computer and use it in GitHub Desktop.
lei[n_Integer] :=
Range[0, n] //
1 + 2 # & //
Partition[#, 2] & //
Map[1./Times @@ # &] //
Total //
#*8 &;
lei[10000]
lei2[n_Integer] := MapThread[#2 *1./#1 &, {
Range[0, n] // 1 + 2*# &,
Range[0, n] // (-1)^# &}
] // Total // #*4 &
lei2[10000]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment