The concept of 40 days existing as a preparation was seen by Elijah, who fasted and journeyed to Horeb for 40 days (1 Kings 19:8). There are dozens of other references to the number 40 in the Old Testament.
The Catholic Fact Book, copyright 1986 by John Deedy, published by Thomas More Press, page 360:
Lent is the 40-day period (Sundays excluded) prior to Easter, which the church observes as a penitential season. It begins on Ash Wednesday (which can occur any time between February 4 and March 11, depending upon the date of Easter), and it concludes with the Passiontide, the two-week period during which the church's liturgy follows Christ's activity closely through the final stages of his life on earth. These two weeks are called Passion Week and Holy Week. It was once claimed that the Lenten practice was of apostolic origin, but historians fix its establishment at a later date, probably the 5th century. Catholics are required to fast and are urged to adopt other penitential modes during the season.The Catechism of the Catholic Church:
540 ... "For we have not a high priest who is unable to sympathize with our weaknesses, but one who in every respect has been tested as we are, yet without sinning" [Heb 4:15]. By the solemn forty days of Lent the Church unites herself each year to the mystery of Jesus in the desert.