mercredi 31 mars 2021

how to find if M is actually an output of 2power(2n) + 1 in C program

I have a tricky requirement in project asking to write funtion which returns a value 1(0 otherwise). if given an integer representable a (2^2n)+1. n being any non-negative integer . int find_pow_2n_1(int M);

for e.g: return 1, when M=5 since 5 is output when n=1 -> (2^1*2)+1 .

I am trying to evaluate the equation but it results in log funtion , not able to find any kind of hint while browsing in google as well .

Aucun commentaire:

Enregistrer un commentaire