Quote from the Bhagavata Purana
"The chanting of the holy name of Lord Visnu is the best process of atonement for a thief of gold or other valuables, for a drunkard, for one who betrays a friend or relative, for one who kills a brahmana, or for one who indulges in sex with the wife of his guru or another superior. It is also the best method of atonement for one who murders women, the king or his father, for one who slaughters cows, and for all other sinful men. Simply by chanting the holy name of Lord Visnu, such sinful persons may attract the attention of the Supreme Lord, who therefore considers, "Because this man has chanted My holy name, My duty is to give him protection.
By following the Vedic ritualistic ceremonies or undergoing atonement, sinful men do not become as purified as by chanting once the holy name of Lord Hari. Although ritualistic atonement may free one from sinful reactions, it does not awaken devotional service, unlike the chanting of the Lord's names, which reminds one of the Lord's fame, qualities, attributes, pastimes and paraphernalia.
Consequently, for one who wants liberation from the fruitive reactions of material activities, the chanting of the Hare Krsna mantra, or glorification of the name, fame and pastimes of the Lord, is recommended as the most perfect process of atonement because such chanting eradicates the dirt from one's heart completely.
At the time of death, this Ajamila helplessly and very loudly chanted the holy name of the Lord, Narayana. That chanting alone has already freed him from the reactions of all sinful life. Therefore, O servants of Yamaraja, do not try to take him to your master for punishment in hellish conditions." (SB Canto 6. Ajamila Delivered by the Visnudutas)
Of course we know that Ajamila chanted without offense, since he wasn't even conscious of the fact that he called out helplessly to the supreme Lord Narayana. He was in a very fallen condition and he just called his son and never even considered chanting the holy names of the Lord deliberately in order to nullify his horrible sins. Therefore he attracted the causeless mercy of Lord Narayana.
Regarding deliberately sinning and at the same time trying to nullify the the reactions purposefully by chanting of the holy Names:
"Raghunatha dasa Babaji,: “Harinama rewards the namaparadhi by fulfilling his material desires, which initially had motivated him to chant. However, he is never blessed with prema. Furthermore, along with his fulfilled desires, he also has to suffer the consequences of namaparadha, because his chanting was instigated by material duplicity. Nevertheless, occasionally his chanting is free from mundane cunning and caprice. In these moments, his chanting may be evaluated as sukrti. When this sukrti matures and accumulates to a substantial amount, he is rewarded with the sanga of a Vaisnava who is attached to suddha-harinama. Under this good influence, the nama-aparadhi learns to chant properly and overcomes his namaparadha. This methodology has also helped steadfast monists and emancipationists to gradually attain the platform of suddha-bhakti.”
Vijaya,: “Master, if one suddha-nama is potent enough to nullify all sins, then why is it necessary to chant incessantly?”
Raghunatha dasa Babajé,: “The heart, consciousness, and demeanour of the nama-aparadhis are always materially contaminated, depriving them of their natural interest in Krsna. They develop distaste for the sadhus, spiritual topics, and eventually anything related with transcendence. Simultaneously, they develop an affinity for asat-sanga, misinterpretation of sastra, and immoral activities. However, non-stop harinama can progressively turn them away from these impediments on the path of bhakti. Therefore, eventually, without the contamination of asat-sanga, immorality, etc., their chanting will gradually become purified, and thus spirituality will grow stronger in their lives.”
(Srila Saccidananda Bhaktivinoda Thakura, Jaiva-dharma, Chapter Twenty-five, Part Thirteen)