Skip to main content

All Questions

2 votes
2 answers
999 views

Generating all permutations of 1 digit, 2 equal letters and 2 different letters efficiently

I created a function that generates all the combinations of 1 digit, 2 equal letters and 2 different letters. I reduced the numbers and letters to make it more easy to calculate: ...
E235's user avatar
  • 237
7 votes
2 answers
222 views

4 distinct integers, whose reciprocals sum up to 1

I wrote the following short python program to solve a math puzzle, which asked for all the 4-tuples of distinct natural numbers whose reciprocals sum up to 1. ...
elias's user avatar
  • 171
4 votes
1 answer
1k views

Permutation index Python

Here is my Python code for finding the permutation index of a given digits and a target number. And by permutation index I mean, for example, given digits ...
Rockybilly's user avatar
7 votes
5 answers
2k views

Improving efficiency of Project Euler 185 (16-place Mastermind)

This a solution for Project Euler Problem 185. It works fine for the example but slow for the problem statement. How can I improve its speed and efficiency? ...
sundar nataraj's user avatar
6 votes
2 answers
409 views

Central Delannoy numbers

I am solving this problem on SPOJ Upper Right King (Hard): There is a king in the lower left corner of the \$ n \times n \$ chess board. The king can move one step right, one step up or one step up-...
rohspeed's user avatar