'C program to find positive integers with beautiful property

I made a C program to search for positive integers that has this kind of property:

enter image description here

So clearly I want the program to at least output the number 262144, but my program does not output this. And also 1 has this property, and my program does output this.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

long double digitspow(long int num){

   char numstr[30];

   sprintf(numstr,"%ld",num);   

   int n=strlen(numstr);
   int digits[n];
   long int total=((int) numstr[0])-48;

   for (int i=1; i<n;i++){
            
            digits[i]=((int) numstr[i])-48;
            total=pow(total,digits[i]);
            
   }
   return sqrt(total);

}

int main()
{

long int num;


for (int i=1;i<20000000;i++){

   num=i;
   if (abs(num - digitspow(num))<0.0000001){
    printf("%ld\n",num);
   }

}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source