but here we need to know the number of pages,not the frames.
here,it is asking the size of page table ,which is number of page table entries * size of each entry.
now,logical address is virtual address only as you said.
logical address is divided into pages.and here logical address is 40 bits long.
so number of pages shoud be 240/213 = 227