L = n となる a, b に分解する tbla, tblb 2^w 個の配列を用意する tbla[0] = tblb[0] = 0 for i from 1 to 2^w-1: tbla[i] = tbla[i-1] + P # tbla[i] = i P tblb[i] = L tbla[i] # tblb[i] = i L P Q = 0 for i from 0 to ⌈L/2/w⌉: Q = 2^w Q Q = Q + tblb[bのiwビットからwビットを取り出す] Q = Q + tbla[aのiwビットからwビットを取り出す] return Q 6 / 19