Sort by

recency

|

136 Discussions

|

  • + 0 comments

    Great post on Smith Numbers! For those diving deeper into number theory, it's fascinating to see how these numbers bridge the gap between math and patterns. Have you considered how tools like Drift Boss can help visualize complex concepts like these? Utilizing games or puzzles could enhance understanding by making the learning process more interactive. Keep sharing such insightful content!

  • + 0 comments

    That sounds frustrating! Dealing with laptop issues is such a time-sink. When my old laptop started acting up, I almost lost it. I found a great resource online, though, which helped me diagnose some things myself. Speaking of things to do to unwind after a stressful tech day, maybe check out "Crazy Cattle 3D" on your phone? It's a silly, mindless game that always makes me laugh. Hope you get your Dell sorted soon!

  • + 0 comments

    Need top-notch Dell Laptop Service Center in Mumbai? Our skilled technicians are here to tackle any laptop problem, whether it's a hardware malfunction or a software glitch. We offer fast and dependable repairs to get your laptop back in action quickly. Reach out to us today for expert laptop service and support!

  • + 0 comments
    public static int solve(int nn) {
        // Write your code here
                      int ds=0;
            int temp=nn;
            int n=nn;
            List<Integer> a=new ArrayList<>();
            while(temp>0){
                ds+=temp%10;
                temp/=10;
            }
            
             while (n % 2 == 0) {
               a.add(2);
                n /= 2;
            }
            for (int i = 3; i <= Math.sqrt(n); i += 2) {
                while (n % i == 0) {
                    a.add(i);
                    n /= i;
                }
            }
     
            if (n > 2)
               a.add(n);
            
            
            int fsum=0;
            
            for(int i:a)
            {
                while(i>0){
                    fsum+=i%10;
                    i=i/10;
                }
            }
            //System.out.println(a);
            if(fsum==ds)
                return 1;
            return 0;
        }
    
  • + 0 comments
    #include <vector>
    #include <cmath>
    using namespace std;
    
    // Function to calculate the sum of digits of a number
    int sumOfDigits(int n) {
        int sum = 0;
        while (n > 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
    }
    
    // Function to find the prime factors of a number
    vector<int> primeFactors(int n) {
        vector<int> factors;
        for (int i = 2; i <= sqrt(n); ++i) {
            while (n % i == 0) {
                factors.push_back(i);
                n /= i;
            }
        }
        if (n > 1) {
            factors.push_back(n);
        }
        return factors;
    }
    
    // Function to check if a number is a Smith number
    bool isSmithNumber(int n) {
        if (n < 2) return false; // Numbers less than 2 are not Smith numbers
    
        vector<int> factors = primeFactors(n);
    
        if (factors.size() == 1) {
            return false; // Prime numbers are not Smith numbers
        }
    
        int digitSum = sumOfDigits(n);
        int factorsDigitSum = 0;
    
        for (int factor : factors) {
            factorsDigitSum += sumOfDigits(factor);
        }
    
        return digitSum == factorsDigitSum;
    }
    
    int main() {
        int n;
        cin >> n;
    
        if (isSmithNumber(n)) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    
        return 0;
    }