Exodus 25: 31 - 35: And thou shalt make a candlestick of pure gold: of beaten work shall the candlestick be made: his shaft, and his branches, his bowls, his knops, and his flowers, shall be of the same. And six branches shall come out of the sides of it; three branches of the candlestick out of the one side, and three branches of the candlestick out of the other side: Three bowls made like unto almonds, with a knop and a flower in one branch; and three bowls made like almonds in the other branch, with a knop and a flower: so in the six branches that come out of the candlestick. And in the candlestick shall be four bowls made like unto almonds, with their knops and their flowers. And there shall be a knop under two branches of the same, and a knop under two branches of the same, and a knop under two branches of the same, according to the six branches that proceed out of the candlestick.
Each branch of the Menorah has three bowls, three knops and three flowers (27 in total on each set of three branches), whilst the trunk has four bowls, four knops and four flowers (12 in total).
The Old Testament has 39 books (27 + 12) and the New Testament has 27 books.