How to know if a number N is divisible by k ? ( N <= 10^5000000) ?

Revision en1, by arius1408, 2021-10-18 19:19:16

Um, hi ... ? Basically we have a number N (N <= 10^5000000) represented by a string. Let say that |N] = the length of string N. Now I'm given an integer k (k <= 1e9). How do I confirm that N is divisible by k in O(|N|) ??

P/S : Notice that I want solution that works in O(|N|), not O(|N|log5000000). Anyone can help me ?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English arius1408 2021-10-18 19:19:16 391 Initial revision (published)