Skip to content

Instantly share code, notes, and snippets.

@mindaslab
Last active January 27, 2019 14:26
Show Gist options
  • Select an option

  • Save mindaslab/68defbc60e916cc26b8ef85e4fe2fd4b to your computer and use it in GitHub Desktop.

Select an option

Save mindaslab/68defbc60e916cc26b8ef85e4fe2fd4b to your computer and use it in GitHub Desktop.

Revisions

  1. mindaslab renamed this gist Jan 27, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. mindaslab created this gist Jan 27, 2019.
    139 changes: 139 additions & 0 deletions whatapp_stupidity.pynb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,139 @@
    {
    "cells": [
    {
    "cell_type": "code",
    "execution_count": 5,
    "metadata": {},
    "outputs": [
    {
    "name": "stdout",
    "output_type": "stream",
    "text": [
    "Share Count: 1\n",
    "People Getting Message (this iteration): 5\n",
    "People who have got message (total): 6\n",
    "====================\n",
    "\n",
    "Share Count: 2\n",
    "People Getting Message (this iteration): 25\n",
    "People who have got message (total): 31\n",
    "====================\n",
    "\n",
    "Share Count: 3\n",
    "People Getting Message (this iteration): 125\n",
    "People who have got message (total): 156\n",
    "====================\n",
    "\n",
    "Share Count: 4\n",
    "People Getting Message (this iteration): 625\n",
    "People who have got message (total): 781\n",
    "====================\n",
    "\n",
    "Share Count: 5\n",
    "People Getting Message (this iteration): 3125\n",
    "People who have got message (total): 3906\n",
    "====================\n",
    "\n",
    "Share Count: 6\n",
    "People Getting Message (this iteration): 15625\n",
    "People who have got message (total): 19531\n",
    "====================\n",
    "\n",
    "Share Count: 7\n",
    "People Getting Message (this iteration): 78125\n",
    "People who have got message (total): 97656\n",
    "====================\n",
    "\n",
    "Share Count: 8\n",
    "People Getting Message (this iteration): 390625\n",
    "People who have got message (total): 488281\n",
    "====================\n",
    "\n",
    "Share Count: 9\n",
    "People Getting Message (this iteration): 1953125\n",
    "People who have got message (total): 2441406\n",
    "====================\n",
    "\n",
    "Share Count: 10\n",
    "People Getting Message (this iteration): 9765625\n",
    "People who have got message (total): 12207031\n",
    "====================\n",
    "\n",
    "Share Count: 11\n",
    "People Getting Message (this iteration): 48828125\n",
    "People who have got message (total): 61035156\n",
    "====================\n",
    "\n",
    "Share Count: 12\n",
    "People Getting Message (this iteration): 244140625\n",
    "People who have got message (total): 305175781\n",
    "====================\n",
    "\n",
    "Share Count: 13\n",
    "People Getting Message (this iteration): 1220703125\n",
    "People who have got message (total): 1525878906\n",
    "====================\n",
    "\n",
    "Share Count: 14\n",
    "People Getting Message (this iteration): 6103515625\n",
    "People who have got message (total): 7629394531\n",
    "====================\n",
    "\n",
    "Share Count: 15\n",
    "People Getting Message (this iteration): 30517578125\n",
    "People who have got message (total): 38146972656\n",
    "====================\n",
    "\n"
    ]
    },
    {
    "data": {
    "text/plain": [
    "15"
    ]
    },
    "execution_count": 5,
    "metadata": {},
    "output_type": "execute_result"
    }
    ],
    "source": [
    "people_who_received_messge = 1\n",
    "number_of_shares = 5\n",
    "iterations = 15\n",
    "\n",
    "iterations.times do |share_count|\n",
    " ppl_getting_message = number_of_shares ** (share_count + 1)\n",
    " people_who_received_messge += ppl_getting_message\n",
    " puts \"Share Count: #{share_count + 1}\"\n",
    " puts \"People Getting Message (this iteration): #{ppl_getting_message}\"\n",
    " puts \"People who have got message (total): #{people_who_received_messge}\"\n",
    " puts \"=\" * 20\n",
    " puts\n",
    "end"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": []
    }
    ],
    "metadata": {
    "kernelspec": {
    "display_name": "Ruby 2.5.1",
    "language": "ruby",
    "name": "ruby"
    },
    "language_info": {
    "file_extension": ".rb",
    "mimetype": "application/x-ruby",
    "name": "ruby",
    "version": "2.5.1"
    }
    },
    "nbformat": 4,
    "nbformat_minor": 2
    }