touhidurrr's blog

By touhidurrr, history, 3 years ago, In English

Hi. I wanted to make an example of splitting up recursive functions on python because python returns error if the level of a recursive function gets to deep. And somehow got this funny thing that returns the higest power of 2 from 1 to n given n. Not sure how exactly it happens. Can anyone explain it Mathematically maybe?

def example(n):
  if n < 2: return 1
  return example(n/2) + example(n/2)

def example2(n):
  if n < 2: return 1
  return example2(n/4) + example2(n/4) + example2(n/4) + example2(n/4)

print(example(100), example2(100))
# prints 64 64

print(example(1600), example2(1600))
# prints 1024 1024

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By touhidurrr, history, 5 years ago, In English

Somehow in my profile, the date that I had registered has been changed to 1/1/1970 and is showing that I had joined the cf 50 years ago.

Someone told me that he had experienced the same once and it was automatically fixed.

What is going wrong actually.......?

UPDATE: The problem fixed automatically, reasons unknown.

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it