Sort by

recency

|

73 Discussions

|

  • + 6 comments

    why 23 in between 21 and 25 is not lucky number,

    as we are getting digit sum 5, and sum of square of digits are 13.

  • + 0 comments

    def luckyNumbers(a, b): lucky_nums=[] seq=range(a,b+1) for num in seq: number=num sum=0 sum_sqr=0 while num!=0: remain=num%10 sum+=remain sum_sqr+=(remain**2) num=num//10

        count1=0
        for i in range(1,sum+1):
            if(sum%i==0):
                count1+=1
    
        count2=0
        for j in range(1,sum_sqr+1):
            if(sum_sqr%j==0):
                count2+=1
        if count1==2 and count2==2:
            lucky_nums.append(number)
    
    return len(lucky_nums)               
    
  • + 0 comments

    Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Lucky Numbers Problem Solution

  • + 0 comments

    Why not work for number very long in javascript?

  • + 0 comments

    Here is Lucky Numbers problem solution in Python Java C++ and C programming - https://programs.programmingoneonone.com/2021/07/hackerrank-lucky-numbers-problem-soluton.html