ABC:1 Chronicles 24

Verse 6
The ReasonProject lists the following as a Bible contradiction with the headline "Was Abiathar the father or the son of Ahimelech?"

1 Samuel 22:20 And one of the sons of Ahimelech the son of Ahitub, named Abiathar, escaped, and fled after David.

1 Samuel 23:6 And it came to pass, when Abiathar the son of Ahimelech fled to David to Keilah, that he came down with an ephod in his hand.

2 Samuel 8:17 And Zadok the son of Ahitub, and Ahimelech the son of Abiathar, were the priests; and Seraiah was the scribe;

1 Chronicles 18:16 And Zadok the son of Ahitub, and Abimelech the son of Abiathar, were the priests; and Shavsha was scribe;

1 Chronicles 24:6 And Shemaiah the son of Nethaneel the scribe, one of the Levites, wrote them before the king, and the princes, and Zadok the priest, and Ahimelech the son of Abiathar, and before the chief of the fathers of the priests and Levites: one principal household being taken for Eleazar, and one taken for Ithamar.

Background
Reading 1 Samuel 21 and 22 in context clearly shows that Ahimelech the priest, the son of Ahitub, was the father of Abiathar. What happened was that David while fleeing from Saul went to Ahimelech the priest, who had the sword of Goliath who David had earlier killed. David asked for it, was given Goliath's sword, and Ahimelech gave David the priest's holy bread for his journey (as later mentioned by Jesus in Mark 2:25-26). However, Doeg the Edomite, one of Saul's servants, was there and saw the whole thing, and told Saul what happened.

An enraged Saul then had Ahimelech's whole family slaughtered, 85 priests, at the hand of Doeg, with one exception - Abiathar, one of Ahimelech's children, managed to escape. Abiathar fled to David for protection and served David in the role of priest, later carrying the Ark of the Covenant. (2 Samuel 15:29) However, Abiathar fell out of favor with Solomon later on and was removed from office for supporting Solomon's older brother, in an apparent claim to the throne. (1 Kings 2:26-27) Naturally the critic was doubtless aware that the accounts show Abiathar was the son of Ahimelech, they just ask a rhetorical question to imply there is a contradiction.

1 Samuel 21:1 Then came David to Nob to Ahimelech the priest: and Ahimelech was afraid at the meeting of David, and said unto him, Why art thou alone, and no man with thee? 2 And David said unto Ahimelech the priest, The king hath commanded me a business, and hath said unto me, Let no man know any thing of the business whereabout I send thee, and what I have commanded thee: and I have appointed my servants to such and such a place. 3 Now therefore what is under thine hand? give me five loaves of bread in mine hand, or what there is present. 4 And the priest answered David, and said, There is no common bread under mine hand, but there is hallowed bread; if the young men have kept themselves at least from women. 5 And David answered the priest, and said unto him, Of a truth women have been kept from us about these three days, since I came out, and the vessels of the young men are holy, and the bread is in a manner common, yea, though it were sanctified this day in the vessel. 6 So the priest gave him hallowed bread: for there was no bread there but the shewbread, that was taken from before the LORD, to put hot bread in the day when it was taken away. 7 Now a certain man of the servants of Saul was there that day, detained before the LORD; and his name was Doeg, an Edomite, the chiefest of the herdmen that belonged to Saul. 8 And David said unto Ahimelech, And is there not here under thine hand spear or sword? for I have neither brought my sword nor my weapons with me, because the king's business required haste. 9 And the priest said, The sword of Goliath the Philistine, whom thou slewest in the valley of Elah, behold, it is here wrapped in a cloth behind the ephod: if thou wilt take that, take it: for there is no other save that here. And David said, There is none like that; give it me. 10 ¶ And David arose, and fled that day for fear of Saul, and went to Achish the king of Gath.

1 Samuel 22:11 Then the king sent to call Ahimelech the priest, the son of Ahitub, and all his father's house, the priests that were in Nob: and they came all of them to the king. 12 And Saul said, Hear now, thou son of Ahitub. And he answered, Here I am, my lord. 13 And Saul said unto him, Why have ye conspired against me, thou and the son of Jesse, in that thou hast given him bread, and a sword, and hast enquired of God for him, that he should rise against me, to lie in wait, as at this day? 14 Then Ahimelech answered the king, and said, And who is so faithful among all thy servants as David, which is the king's son in law, and goeth at thy bidding, and is honourable in thine house? 15 Did I then begin to enquire of God for him? be it far from me: let not the king impute any thing unto his servant, nor to all the house of my father: for thy servant knew nothing of all this, less or more. 16 And the king said, Thou shalt surely die, Ahimelech, thou, and all thy father's house. 17 And the king said unto the footmen that stood about him, Turn, and slay the priests of the LORD; because their hand also is with David, and because they knew when he fled, and did not shew it to me. But the servants of the king would not put forth their hand to fall upon the priests of the LORD. 18 And the king said to Doeg, Turn thou, and fall upon the priests. And Doeg the Edomite turned, and he fell upon the priests, and slew on that day fourscore and five persons that did wear a linen ephod. 19 And Nob, the city of the priests, smote he with the edge of the sword, both men and women, children and sucklings, and oxen, and asses, and sheep, with the edge of the sword. 20 ¶ And one of the sons of Ahimelech the son of Ahitub, named Abiathar, escaped, and fled after David. 21 And Abiathar shewed David that Saul had slain the LORD'S priests. 22 And David said unto Abiathar, I knew it that day, when Doeg the Edomite was there, that he would surely tell Saul: I have occasioned the death of all the persons of thy father's house. 23 Abide thou with me, fear not: for he that seeketh my life seeketh thy life: but with me thou shalt be in safeguard.

Ahimelech Returns
As seen from the Interlinear (original Hebrew text overlaying the English), Ahimelech is mentioned first as Abiathar's father in 1 Samuel 21-30, but after 2 Samuel 8 begins getting mentioned as the son of Abiathar. Thus a strong possibility is that Abiathar just named his son Ahimelech after the father who had been murdered by Saul.

Chronologies of David's life show that somewhere from 15-30 years passed between the time Ahimelech, Abiathar's father was killed in 1 Samuel 22, and the period in 2 Samuel 8:17/1 Chronicles 24 where Ahimelech is now mentioned as alive and the son of Abiathar. 2 Samuel 2:11 mentions David reigning 7.5 years over Judah during part of this time. 2 Samuel 5:4 mentions that David was 30 years old when he began reigning and that he reigned 33 years. At any rate, 15-30 years is enough time for Abiathar to have had a son who became a priest like his father and grandfather (in those days, priesthood was restricted to the Levites, one of Israel's tribes, so it was a family profession). The following is the Interlinear for all passages where Ahimelech's name is mentioned in the Bible:

1 Samuel 21:1 Then came  David  to Nob  to Ahimelech <'Achiymelek> the priest : and Ahimelech <'Achiymelek> was afraid at the meeting  of David , and said <'amar> unto him, Why art thou alone, and no man <'iysh> with thee? 2 And David  said <'amar> unto Ahimelech <'Achiymelek> the priest, The king hath commanded me a business, and hath said <'amar> unto me, Let no man <'iysh> know  any thing  of the business whereabout I send thee, and what I have commanded thee: and I have appointed  my servants  to such  and such <'almoniy> a place. 1 Samuel 21:8 And David  said <'amar> unto Ahimelech <'Achiymelek>, And is there not <'iyn> here under thine hand spear or sword ? for I have neither brought my sword nor my weapons  with me, because the king's business required haste. 9 Then answered <`anah> Doeg  the Edomite <'Edomiy>, which was set over the servants <`ebed> of Saul , and said <'amar>, I saw  the son of Jesse <Yishay> coming <bow'> to Nob <Nob>, to Ahimelech <'Achiymelek> the son of Ahitub <'Achiytuwb>.

1 Samuel 22:11 Then the king sent to call <qara'> Ahimelech <'Achiymelek> the priest, the son of Ahitub <'Achiytuwb>, and all his father's <'ab> house , the priests that were in Nob <Nob>: and they came <bow'> all of them to the king. 1 Samuel 22:14 Then Ahimelech <'Achiymelek> answered <`anah> the king, and said <'amar>, And who is so faithful <'aman> among all thy servants <`ebed> as David <David>, which is the king's son in law , and goeth at thy bidding <mishma`ath>, and is honourable in thine house ? 1 Samuel 22:16 And the king said <'amar>, Thou shalt surely die, Ahimelech <'Achiymelek>, thou, and all thy father's <'ab> house. 1 Samuel 22:20 ¶ And one <'echad> of the sons of Ahimelech <'Achiymelek> the son of Ahitub <'Achiytuwb>, named Abiathar <'Ebyathar>, escaped, and fled after <'achar> David <David>. 1 Samuel 23:6 And it came to pass, when Abiathar <'Ebyathar> the son of Ahimelech <'Achiymelek> fled to David <David> to Keilah <Q@`iylah>, that he came down with an ephod <'ephowd> in his hand. 1 Samuel 26:6 ¶ Then answered <`anah> David <David> and said <'amar> to Ahimelech <'Achiymelek> the Hittite <Chittiy>, and to Abishai <'Abiyshay> the son of Zeruiah <Ts@ruwyah>, brother <'ach> to Joab <Yow'ab>, saying <'amar>, Who will go down with me to Saul <Sha'uwl> to the camp ? And Abishai <'Abiyshay> said <'amar>, I will go down with thee. 1 Samuel 30:7 ¶ And David <David> said <'amar> to Abiathar <'Ebyathar> the priest, Ahimelech's <'Achiymelek> son , I pray thee, bring me hither the ephod <'ephowd>. And Abiathar <'Ebyathar> brought thither the ephod <'ephowd> to David <David>.

AHIMELECH BEGINS GETTING MENTIONED AS ABIATHAR'S SON

2 Samuel 8:17 And Zadok <Tsadowq> the son of Ahitub <'Achiytuwb>, and Ahimelech <'Achiymelek> the son of Abiathar <'Ebyathar>, were the priests ; and Seraiah < S@rayah> was the scribe ; 1 Chronicles 24 24:3 And David <David> distributed them, both Zadok <Tsadowq> of the sons of Eleazar <'El`azar>, and Ahimelech <'Achiymelek> of the sons of Ithamar <'Iythamar>, according to their offices <p@quddah> in their service <`abodah>. 1 Chronicles 24:6 And Shemaiah <Sh@ma`yah> the son of Nethaneel <N@thane'l> the scribe, one of the Levites <Leviyiy>, wrote them before the king , and the princes , and Zadok <Tsadowq> the priest , and Ahimelech <'Achiymelek> the son of Abiathar <'Ebyathar>, and before the chief <ro'sh> of the fathers <'ab> of the priests and Levites <Leviyiy>: one <'echad> principal <'ab> household being taken <'achaz> for Eleazar <'El`azar>, and one taken <'achaz> for Ithamar <'Iythamar>. 1 Chronicles 24:31 These likewise cast lots over against <`ummah> their brethren <'ach> the sons of Aaron <'Aharown> in the presence of David <David> the king, and Zadok <Tsadowq>, and Ahimelech <'Achiymelek>, and the chief <ro'sh> of the fathers <'ab> of the priests and Levites <Leviyiy>, even the principal <ro'sh> fathers <'ab> over against <`ummah> their younger brethren <'ach>. Psalms 52:1 ¶ <<To the chief Musician, Maschil , A Psalm of David <David>, when Doeg <Do'eg> the Edomite <'Edomiy> came <bow'> and told Saul <Sha'uwl>, and said <'amar> unto him, David <David> is come <bow'> to the house of Ahimelech <'Achiymelek>.>> Why boastest thou thyself in mischief <ra`>, O mighty man? the goodness of God <'el> endureth continually.

2 Samuel 8:17 Controversial
Furthermore, the 2 Samuel 8:17 passage is controversial since some older manuscripts transpose the names, mentioning Abiathar as the son of Ahimelech rather than the other way around.

"Instead of Ahimelech the son of Abiathar, the Syriac transposes the names, and reads, 'Abiathar the son of Ahimelech' This agrees with the list in 2 Samuel 20:25, and it is certain that Abiathar outlived David (1 Kings 2:26), and that he was David's high priest throughout his reign, though Zadok is not only constantly associated with him, but is placed first, as the man of higher rank (2 Samuel 15:24-35; 2 Samuel 17:15; 2 Samuel 19:11; 2 Samuel 20:25)."

-The Pulpit Commentary

Conclusion
Given the extensive time difference between the passages where Abiathar is mentioned as the son of Ahimelech, and the passages where Ahimelech is mentioned as the son of Abiathar, it's quite possible Abiathar just had a son named Ahimelech in honor of his murdered father.