Got to be kidding!

How many digits are there in the number of equivalence relations on a set of 1000 elements?


The answer is 1928.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Abdelhamid Saadi
Mar 26, 2016

Solution with only one line.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def bell(n):
    "Got to be kidding!"
    lst = [1] + [0]*(n-1)
    for m in range(n -1):
        save, lst[0]  = lst[0], lst[m]
        for k in range(1, m + 2):
            save, lst[k] = lst[k], lst[k-1] +  save
    return  lst[n-1]

print(len(str(bell(1000))))

Bill Bell
Mar 15, 2016

To compute the next row only the current row is needed, which saves space. Also, we need not keep any Bell numbers preceding the 1000th.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
def Bell():
    line_1=[1]
    while True:
        yield line_1[0]
        line_2=[line_1[-1]]
        for _ in range(len(line_1)):
            line_2.append(line_1[_]+line_2[_])
        line_1=line_2

for n, b in enumerate(Bell()):
    if n==1000:
        print(len(str(b)))
        break

Department 8
Feb 22, 2016
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def bell_numbers(start, stop):

   t = [[1]]                        ## Initialize the triangle as a two-dimensional array
   c = 1                            ## Bell numbers count
   while c <= stop:
       if c >= start:
           yield t[-1][0]           ## Yield the Bell number of the previous row
       row = [t[-1][-1]]            ## Initialize a new row
       for b in t[-1]:
        row.append(row[-1] + b)  ## Populate the new row
       c += 1                       ## We have found another Bell number
       t.append(row)                ## Append the row to the triangle
   for b in bell_numbers(1, 1000):
       print b

Then I copied the whole number and pasted it in answer box but we can only paste 33 digits and it shows how much we pasted.

Dude, you copied me. Cheating!! Lol

Ashish Menon - 5 years, 3 months ago

Log in to reply

Where I copied you?

Department 8 - 5 years, 3 months ago

Log in to reply

Just joking bro. U figured the no. of digits ezactly the same way i did.

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Ah! U mean that you used the same code?

Department 8 - 5 years, 3 months ago

Log in to reply

@Department 8 Same code and same technique for finding no. of digits.

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Yeah I also used this for this question

Department 8 - 5 years, 3 months ago

Log in to reply

@Department 8 Same pitch.haha

Ashish Menon - 5 years, 3 months ago
Soumava Pal
Feb 21, 2016

W o l f r a m A l p h a Wolfram Alpha to the rescue .

Ok, i think this should have been a computer science question

Ashish Menon - 5 years, 3 months ago

Log in to reply

Exactly. Because it is not humanly possible, at least not by the limitations of my knowledge, (and I know too little) to do this manually.

Soumava Pal - 5 years, 3 months ago

Log in to reply

Yes, goodnight bro.

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Goodnight, brother.

Soumava Pal - 5 years, 3 months ago

Log in to reply

@Soumava Pal Goodmorning, dude

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Good Morning, man!

Soumava Pal - 5 years, 3 months ago

Log in to reply

@Soumava Pal Haha, grt ,it is like a social media . Much the same way, i do with my brother like friend Rishabh Sood.

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Lol, I was just going to ask if it is okay to talk here like on a social media.... anyway, it's great , then! Are you on Facebook?

Soumava Pal - 5 years, 3 months ago

Log in to reply

@Soumava Pal Yes, i have joined brilliant with fb

Ashish Menon - 5 years, 3 months ago

Log in to reply

@Ashish Menon Yeah, I found you.

Soumava Pal - 5 years, 3 months ago

Log in to reply

@Soumava Pal Me too, got u

Ashish Menon - 5 years, 3 months ago
Ashish Menon
Feb 21, 2016

The answer is 10^1927.47991= 29899013356824084214804223538976464839473928098212305047832737888945413625123259596641165872540391578300639147082986964028021802248993382881013411276574829121155811755170830666039838837273971971676782389800810361809319250755399325279656765435255999301529770267107281619733800281695881540007577899106878679451165492535930459233713316342551545242815802367257284852612201081016386308535990145447341800455472334713864080523978960296365736999295932080550928561633025800627524911700149562106895897725047744775812241800937310491797818107578233924187312824632629095993832334781713007323483688294825326897450386817327410532925074613888321264138083842196202242956001314953449497244271843922741908252107652201346933889741070435350690242062001522697855278356012055718392851567813397125419144780476479197990921602015873703820769182603836788465785093563686025690269802153802436873530877006737154523895273029510238745997356292232631282773748762989386003970214423843947094021177989737557020369751561595003372955621411858485959813344799967960196238368337022346946771703060269288691694028444791203978533454759410587065022546491518871238421560825907135885619221776405898771057270555581449229994215739476758785884545723062263992367750091319644861547658472282284005892044371587560711880627741139497818835632120761570174928529697397267899554407350161283097123211048049269727655279783900702416095132827766428865017653366696304131436690232979453876337599721772897049270230544262611264917393374756384152784943607952408782612639220380791445272655004475989064276373713608901650681165467490310898804916827069427310961109285035545084791339423266482359955663377201515204340817580915468489969181643341007197836481461051798995640789292580146918580703759556634019451731530034209189203377522668309771129566108101617727442045637098112678864654309987785463307376544339506878267267349348171320834971956806668304099159992067385998690820326902473886782781499414773179 It has 1928 1928 digits.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...