Does anyone have a formula for dynamic block durations? I want to implement this, so does anyone have a formula for dynamic block durations instead of a fixed target of 10 minutes?
Block duration is only controlled by difficulty (although indirectly) and network hashrate, so you'd want to increase difficulty when there are very few transactions in the last X blocks, and vice versa, decrease difficulty when blocks become too full, but also decrease difficulty when there is a low hashrate, and increase difficulty when there is a high hashrate.

At the same time, you'd need to incentivize mining, so you might want to have a reward relative to target time, instead of constant per block, as otherwise miners could spam the network in order to increase revenue.

A draft

Let's say, we are aiming to adjust from looking at the last 100 blocks for blocks that are 50% full.  

findNewBlockTime():
  newTimeTarget = (avBlockInterval100)*(0.5/averageFullness); //shorter interval with many transactions, longer with less

setReward():
  newReward = newTimeTarget*totalIntervalReward/rewardInterval; //rewardInterval could be four years like Bitcoin, or some other interval, with four years totalIntervalReward would be 11.5M coins for first interval

calculateDifficulty():
  newDifficulty = sumDiffLast100/last100BlocksTime*newTimeTarget;