Number Theory Problem: To transmit a positive integer less than 1000, the Networked Number Node offers two options.
Option 1. Pay $d to send each digit d. Therefore, 987 would cost $9 + $8 + $7 = $24 to transmit.
Option 2. Encode integer into binary (base 2) first, and then pay $d to send each digit d. Therefore, 987 becomes 1111011011 and would cost $1 + $1 + $1 + $1 + $0 + $1 + $1 + $0 + $1 + $1 = $8.
What is the largest integer less than 1000 that costs the same whether using Option 1 or Option 2?

Respuesta :

Answer:

In C, int requires 4 butes to sotre a integer number. that means it requires 4*8 = 32 bits. The maximum number can be stored using 32 bits is

The first digit is used for sign. decimal equivalent to this number can be computed as

=

=

That means int can store a up to 2147483646.

                     Testing with C code

#include<stdio.h>

int main()

{

 int a = 2147483647; // a with max number

 printf("%d\n",a);// printing max number

 a = a+1;// adding one to the number

 printf("%d\n",a);// printing the number after adding one

 return 0;

}

               THE OUTPUT

$ ./a.out

2147483647

-2147483648

Step-by-step explanation:

PLEASE LIKE THIS OR LET IT BE HELPFUl