# How Many Friends Are On The Riddler Social Network?

A FiveThirtyEight Riddler puzzle.
Riddler
mathematics
Published

November 5, 2021

## Riddler Riddler Express

A group of $$101$$ people join $$μετα$$, and each person has a random, $$50$$ percent chance of being friends with each of the other $$100$$ people. Friendship is a symmetric relationship on $$μετα$$, so if you’re friends with me, then I am also friends with you.I pick a random person among the $$101$$ — let’s suppose her name is Marcia. On average, how many friends would you expect each of Marcia’s friends to have?

## Computational Solution

From the simulation below, we see that the expected number of friends of each of Marcia’s friends is $$\textbf{50.5}$$. It is interesting to note that Marcia on average would have only $$50$$ friends.

import networkx as nx
from random import random, randint, choice

def exp_num_friends(n, runs = 10000):
total_deg = 0
for _ in range(runs):
G = nx.Graph()
for i in range(n):
for i in range(n-1):
for j in range(i+1, n):
if random() < 0.5:
marcia = randint(0,n-1)
if marcia_friends:
total_deg += G.degree[choice(marcia_friends)]

print(exp_num_friends(101))

## Riddler Classic

The sum of the factors of $$36$$ — including $$36$$ itself — is $$91$$. Coincidentally, $$36$$ inches rounded to the nearest centimeter is … $$91$$ centimeters!

Can you find another whole number like $$36$$, where you can “compute” the sum of its factors by converting from inches to centimeters?

Extra credit: Can you find a third whole number with this property? How many more whole numbers can you find?

## Computational Solution

From the code below we see that $$378$$ and $$49600$$ are two numbers below $$1000000$$ that satisify the given property.

from functools import reduce

def sum_of_factors(n):
return sum(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

def inches_to_cm_same_as_sum_of_divisors():
nums= []
for i in range(37,1000000):
if round(i*2.54) == sum_of_factors(i):
nums.append(i)
return nums

print(inches_to_cm_same_as_sum_of_divisors())