Skip to main content

All Questions

6 votes
4 answers
2k views

Find all ways to express each of a list of even numbers as the sum of 2 positive, even numbers

This code was a challenge from a friend. Essentially she wanted a way to "Divide an even number into 2 even numbers." So I made this quick and dirty Python program to find the solutions up ...
Omar Morales Rivera's user avatar
3 votes
1 answer
424 views

Find perfect squares within a given range

I managed to make this work without breaking the program if you enter some weird numbers in the range. The thing is I know this could have been done simpler and smarter. I can't really see how right ...
el.brollo.loco's user avatar
1 vote
2 answers
67 views

Ask 2 terms from user and add them

I'm making a program that can add 2 terms that the user types. I think I've got identifying or evaluating the terms down. I used classes because I just recently learned it and I also heard it was good ...
Sean Balbuena's user avatar
0 votes
1 answer
428 views

Finding Mersenne primes

An attempt to find Mersenne primes using the Lucas-Lehmer primality test: ...
LOHO's user avatar
  • 11
2 votes
1 answer
48 views

A prime number checker (Multi numbers).py

so obviously this SIMPLE code checks if the number is prime or not. I need to make it more advanced, easier to use, fewer lines or any improvement. ...
LyZeN77's user avatar
  • 147
2 votes
1 answer
484 views

Graphing various mathematical functions in Python

1) This code's task is to create graphs of various algebraic, logarithmic and trigonometric functions and relations using Python's matplotlib.plyplot module. ...
notak's user avatar
  • 605
1 vote
2 answers
410 views

Monte-Carlo method to check triangle inequality

This is code for finding if inequality \$abc > 2(\text{area of triangle})\$ where \$a\$, \$b\$ and \$c\$ are the sides of any triangle. The below, and repl, code work as intended. However they ...
iamauser's user avatar
1 vote
1 answer
2k views

Linear Equation in Two Variables Solver using Python

I made this simple program that can solve every set of linear equations in two variables. You just need to enter two linear equations of the form ax+by=c (without any unnecessary spaces) where 'a' is ...
Rajdeep Sindhu's user avatar
5 votes
2 answers
1k views

Magic Square with Five Methods (Python)

Problem Write a program to return a boolean if an input grid is magic square. A magic square of order \$N\$ is an arrangement of \$N^2\$ distinct integers in a square such that the \$N\$ numbers in ...
Emma's user avatar
  • 3,527
7 votes
2 answers
3k views

Magic Square (Python)

Problem Write a method to return a boolean if an input grid is magic square. A magic square is a \$NxN\$ square grid (where N is the number of cells on each side) filled with distinct positive ...
Emma's user avatar
  • 3,527
8 votes
1 answer
330 views

Find "prime polynomials" for a user's given prime, bounds, and degree

Very amateur programmer and first-time poster here. The program I wrote asks the user for a prime number, a lower and upper bound, and a degree (all of these are integers). I want to generate a list ...
Gizmo's user avatar
  • 183
5 votes
2 answers
3k views

Project Euler Problem 21 in Python: Summing amicable numbers

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b ...
RKJ's user avatar
  • 87
0 votes
1 answer
164 views

Project Euler problem 12 Python

I'm new to python and programming in general and I found Project Euler problems a good way to practice python. But my code is pretty slow. It seems to work, didn't wait long enough for the code to ...
RKJ's user avatar
  • 87
5 votes
2 answers
510 views

Find numbers that are palindromic in consecutive number bases

I want to generate numbers which are palindromic in three or more consecutive number bases in the most optimal, fastest way (up to some range). I do not count trivial one digit palindromes. (...
Vepir's user avatar
  • 258
10 votes
2 answers
1k views

Find highly composite number using Python 3

A highly composite number (HCN) is a positive integer with more divisors than any smaller positive integer ha according to Wikipedia. Here is a YouTube video about it. ...
Phil's user avatar
  • 285

15 30 50 per page