{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter15 - Boolean Algebra"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex15.2 Pg 479"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lcm(2,14) :  14\n"
     ]
    }
   ],
   "source": [
    "from fractions import gcd\n",
    "D=[1,2,5,7,10,14,35,70]#\n",
    "a = 2#  #a and b belong to D\n",
    "b = 14#\n",
    "def lcm(*numbers):\n",
    "    \"\"\"Return lowest common multiple.\"\"\"    \n",
    "    def lcm(a, b):\n",
    "        return (a * b) // gcd(a, b)\n",
    "    return reduce(lcm, numbers, 1)\n",
    "print \"lcm(2,14) : \",lcm(2,14)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
