DEV Community

Cover image for ডিজিটাল রুট (Digital Root)
Prince Billy Graham Karmoker
Prince Billy Graham Karmoker

Posted on

3

ডিজিটাল রুট (Digital Root)

একটি সংখ্যার প্রতিটি ডিজিটকে একত্রে বার বার যোগ করার মাধ্যমে একটি ডিজিট বিশিষ্ট সংখ্যাই রূপান্তর করার প্রক্রিয়াকেই ডিজিটাল রুট বলে। উদাহরণঃ

173 এর ডিজিটাল রুট নির্ণয়:

1 + 7 + 3 = 11
1 + 1 = 2

উত্তরঃ 2

9256987 এর ডিজিটাল রুট নির্ণয়

9 + 2 + 5 + 6 + 9 + 9 + 7 = 46
4 + 6 = 10
1 + 0 = 1

উত্তরঃ 1

এইভাবে ডিজিটাল রুট বের করার পদ্ধতিকে Naive method বলা হয়। যা প্রোগ্রামিঙয়ের মাধ্যমে বার বার লুপ চালিয়ে বের করা যায় (নিজে করো)

এবার আস আরেকটি সহজ পদ্ধতি চিন্তা করি

DigitalRoot(1) = 1
DigitalRoot(2) = 2
DigitalRoot(3) = 3

... ... ...

DigtalRoot(9) = 9

DigitalRoot(10) =1 + 0 -> 1
DigtalRoot(11) = 1 + 1 -> 2
DigitalRoot(12) = 1 + 2 -> 3
DigitalRoot(13) = 1 + 3 = 4

... ... ...

DigitalRoot(18) = 1 + 8 = 9

... ... ...

কি দেখতে পেলে আমরা যদি পর পর প্রতিটি সংখ্যার digital root বের করতে থাকি তাহলে বার বার ১, ২, ৩, ৪, ৫, ৬, ৭ , ৮, ৯ এই মান গুলো পর পর বার বার আসছে। অর্থাৎ শেষবার মান ৯ আসার পর আবারও ১ থেকে মান আসা শুরু হচ্ছে। একই কাজ আমারা ৯ দ্বারা ভাগ করে ভাগশেষ বের করার মাধ্যমে করতে পারি। তবে যখন আমাদের ভাগশেষ ০ আসবে তবে আমাদের ডিজিটাল রুট কে ৯ ধরতে হবে। কিন্তু যদি ০ এর ডিজিটাল রুট বের করতে বলে তাহলে ভাগশেষ ০ হলেও ডিজিটাল রুট ০ ই হবে।

1 mod 9 = 1
2 mod 2 = 2
...
9 mod 9 = 0 (০ কে আমারা ৯ ধরব)

10 mod 9 = 1
11 mod 9 = 2
12 mod 9 = 3
13 mod 9 = 4
...
18 mod 9 = 0 (9)
... ... ...

অর্থাৎ ডিজিটাল রুট নির্ণয়ের সূত্রটি হবে:
alt text

Python code snippet:

def dr(n):
    if n == 0:
        return 0
    m = n % 9
    return m if m != 0 else 9
Enter fullscreen mode Exit fullscreen mode

যার Big(o) Complexity: O(1)

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (4)

Collapse
 
darshkul24 profile image
Darsh

This is dev.to every post you make should be in english as i know bengali i can read it but those who dont know bengali they can't so edit it and everything in english so that everyone can read it

Collapse
 
princebillygk profile image
Prince Billy Graham Karmoker

Ok I will edit it as soon as possible

Collapse
 
hasnaindev profile image
Muhammad Hasnain

LOL. I guess if dev.to had a language section you could've chose your language.

Collapse
 
princebillygk profile image
Prince Billy Graham Karmoker

That would be great but this will be my last Bengali post on dev.to until they have that feature.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs