Question: 3 0 % ) Create an array a based on power of 2 modulo 7 9 . Consider a sequence s this way: it starts

30%) Create an array a based on power of 2 modulo 79. Consider a sequence s this way: it starts with s1=2, and then sn = s n-1*2 mod 79 for all n >=2; in other words, the first few entries of the sequence s are; 2,4,8,16,32,64,49(since 128%79=49),19(why?) etc. This sequence stops when 1 appears in the sequence (because 2,4,8 will appear again by the rule). Whats the size of array a? Write a C program that generates an array a dynamically (at run time) as a[0]=2, a[1]=4,.., a[3]=8, a[4]=16 as the sequence s. Then display the array a in your program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!