I am planning on running an epic-level campaign with a party of indeterminate size. The idea is they will be fighting Asmodeus with a custom stat block who will be approximately CR 40. They will have Tiamat, a CR 30 god fighting on their side (stats from Rise of Tiamat). How many players/NPCs of level 20 will be necessary to make this an encounter of Hard or Deadly difficulty (for a well-balanced party)?
CR 40 would effectively entail more/more powerful attacks, more legendary actions allowed, higher AC, and higher raw scores.
Actually, I found a work-up of Asmodeus that is close but not quite what I want. I will make some minor edits to that, but it is almost what I want. Perhaps a bit higher AC, play around with his legendaries, etc. (with rolling-for-initiative's rules except for Pledge of Tiamat or with a caveat that makes that useless).