← BNY Mellon questions

Count non-negative integers below N with digit sum divisible by k

Filed under BNY Mellon

Given a number N (represented as a string) and an integer k, find the number of non-negative integers strictly less than N whose sum of digits is divisible by k.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related BNY Mellon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.