Python-Playing with number theory and competitive programming





Number theory is branch of pure mathematics devoted primarily to the study of the integers.It is the queen of mathematics and is widely used in creating questions related to competitive programming.It is highly important in physical calculations and is used by highly regarded scientific organizations like NASA etc. A lot of number theory libraries exist like NUMPY,SYMPY etc but how do these libraries work and how to implement your own efficient number theory functions in python?This talk will give the answer at a beginners level


  • Can be used in solving open ended mathematical questions.
  • Can be used to solve competitive programming questions like project euler.
  • For recreational purposes and endless possibilities.
  • Good programming practices and creating efficient programs using python.For eg-fast I/O.
  • Introduction to a whole new world which involves playing with numbers,their properties which will be useful in different areas including cryptography.


  • Introduction to making efficient programs using python useful in making efficient number theory functions.
  • Introduction to various number theory functions like farey sequences, primality testings like miller-rabin etc.
  • How to make these number theory functions in python and how to further optimize.
  • How to use these functions in solving competitive programming questions like that of project euler.
  • How to even further optimize them using little hacks like using list comprehensions instead of for loop in python 3.3 and later.
  • Calculation of important constants in like pi, e etc. using python.
  • Discussion of endless possibilities of these functions-their uses,their optimizations etc.
  • Q and A with audience and live demonstration of their ideas and how it effects running times of current programs.


  • Basic knowledge of Python.
  • Basic knowledge of running complexities.
  • Basic knowledge of mathematical concepts of lcm, gcd, hcf and primes.

Content URLs:

Code snippets:Github

Number theory libraries:

Speaker Info:

My name is Jasdeep Singh,or gamer496(my common handle).I'm an undergrad studying Computer Science at Jiit Sector-62,Noida.I have been using python for different projects and scripts.I'm an open source enthusiast and have contributed to VLC , lmonade and Blender.I'm also an competitive programmer and love solving problems on spoj.

Speaker Links:

Section: Scientific Computing
Type: Talks
Target Audience: Beginner
Last Updated:

Nice one.

Avneet Singh (~avneet)

Can we get the video link please ?

~SH4DOW ROOT (~abhaysingh1998)

Login to add a new comment.