Those numbers represent the hymn's meter. It indicates the number of syllables in each line in the hymn. This provides the means for an organist to mix and match the text of the hymn with a different "tune."
Let's take the hymn "Amazing Grace." Say the words and count the syllables for each line:
Amazing grace, how sweet the sound (8)
that saved a wretch like me. (6)
I once was lost, but now am found (8)
was blind but now I see. (6)
So, somewhere on the page of "Amazing Grace" will be the numbers "8686." That is also known a "Common Meter" and can be written as "CM" instead.
Now that you have that metrical information, you can look at the metrical index in the back of the hymnal and look for the meter "8686" or "CM." All the hymns listed beneath CM or 126.96.36.199 have the same meter which means you can sing the text of "Amazing Grace" to any of those other songs.
Now, you may notice that under the numerical listing, each of the hymns are listed by a name which may be unfamiliar. Those are the "Tune" names. "Amazing Grace" for instance, its tune name is the same as its title. The tune "St. Agnes is to the hymn "Jesus the Very Thought of Thee." "Joy To the World" is known as "Antioch." "O Come All Ye Faithful" is "Adeste Fidelis." "How Great Thou Art" is "O Store Gud." "Holy, Holy, Holy" is "Nicaea."
Back in late sixteenth century England and Scotland, when most people were not musically literate and they learned melodies by rote, it was a common practice to sing a new text to a hymn tune the singers already knew which had a suitable meter and character.
Again, this is a valuable tool for the person planning the music to mix and match melodies and texts. If you don't like the music for a certain text or if your congregation doesn't know a particular melody, you can check the metrical index and find another hymn tune that the congregation will know from another hymn and sing the desired text to that alternate melody.
The composer usually gives his tune a tune name. He (since many composers in the old days were men) would often name the tune for the city, town or church where he was residing at the time he wrote the tune. If I were to write a hymn, I'd probably name it "East Podunk."
If the hymn doesn't have numbers listed as its meter, it will have letters which are a shorthand;
CM means Common Meter, 188.8.131.52;
LM means Long Meter, 184.108.40.206;
SM means Short Meter, 220.127.116.11;
DCM (or CMD) means Doubled CM, 18.104.22.168.22.214.171.124.
8787D is equivalent to doubled or two verses of 126.96.36.199.
I am of the school of thought, “If it isn’t broke, don’t fix it.” The original hymn tune, MARION, is an easy, joyous and well known melody which is most often married to the text “Rejoice, Ye Pure in Heart!” I don’t believe in confusing text and tune. When you hear the melody “Veni Emmanuel” you know it is Advent. When you hear the melody “Stille Nacht” you know it is Christmas Eve. When you hear “Passion Chorale” you know it is Lent. Everyone knows what Lent feels like, what Advent feels like, even the Feast of Christ the King or Palm Sunday. You could tell these days by the opening hymn in many churches. Old Roman Catholics can even tell the difference between the Second Sunday of Easter or any Marion Feast day by of the music alone.
Seasons, music and text all evoke feelings, emotions, moods and memories which is, or should be part of our DNA. I think it is a dangerous thing for the church to mess with tradition and ritual, especially as it pertains to our hymnody. New music is good if it fills a hole.
When we go to a birthday party, we wouldn’t sing a new melody to “Happy Birthday” because the melody we currently sing is traditional and part of our birthday ritual. Everyone knows it. When you go to a ball game, the stadium organist has the power to get the crowd to stomp their feet or entice them to yell “charge,” full throated and in perfect unison with only a few music phrases. That is the power of tradition and ritual. A stadium organist who tries to change those musical cues would be fired the day he starts. That is because we care about our ball games and the full and active participation of our “audience” at our ball games. Also, many of the text writers of our hymns intended for the words to go along with a certain melody.
If I were to sing a new melody to “How Great Thou Art,” that would be nice. But, if I were to just play the first two bars of “O Store Gud,” the melody alone would reduce my grandmother to a puddle of tears because she associates that melody with the text of "How Great Thou Art." Go into a nursing home full of elderly people who can’t remember the name of their own children and start to play the melody to “Amazing Grace,” “How Great Thou Art,” or “Jesus Loves Me,” and they will know every word. It's in their memory DNA.
Did you know that the text to "Amazing Grace" can be sung to the theme of "Gilligan's Island?"