Computer Science, asked by karthikyessekar, 1 year ago

What is g(24) - g(23), given the definition of g below?

def g(n):
s=0
for i in range(1,n+1):
if n%i == 0:
s = s+1
return(s)

Answers

Answered by sswaraj04
18

Explanation:

It's basically program to find number of factors of given value.

It will add +1 to counter when any number i divide given number n

factors of 24 are 1,2,3,4,6,8,12,24

factors of 23 are 1,23

g(24)-g(23) = 8 - 2 = 6

Hope it helps :-)

Answered by AskewTronics
0

6 is the output from the above code :

Explanation:

  • The above code is in python language which returns the number of a factor of any number which is passed in the question.
  • Hence the g(24)-g(23) will return 6, because g(24) will return 8 and g(23) will return 2, then g(24)-g(23) will return (8-2) = (6).
  • The g(24) will return 8 because there is 8 factor of g(24) which are :  "1 2 3 4 6 8 12 24".
  • Then the g(23) will return 2 because there are 2 factors of g(23) which are: 1 and 23.

Learn More :

  • Python : https://brainly.in/question/14689905
Similar questions