Skip to main content

All Questions

Tagged with
7 votes
2 answers
1k views

Squaring the two digits in the middle of a four-digit number

I got a four-digit positive number. I need to square the two digits in middle to generate a new number on which the same procedure is applied. The numbers get saved in a list. This loops as long as ...
OddDev's user avatar
  • 411
3 votes
1 answer
5k views

Probability Chance

I'm creating a game and I need some properties to work as percent chance to hit/dodge. I implemented a small testing program that takes percent chance and the amount of hitting attempts as input and ...
Denis's user avatar
  • 8,508
5 votes
2 answers
11k views

Add item after every nth step

The purpose of the method is to add a list of items after every nth step (5 for example) where the input items are repeated if needed. I'm looking for an overall review and possible how to remove the ...
Dumpen's user avatar
  • 153
3 votes
1 answer
10k views

Calculating distance with Euclidean, Manhattan, and Chebyshev in C#

I am by no means proficient at being able to take mathematical concepts and converting them to code. I was wondering if you guys could look at it and make suggestions on how I could fix it or if my ...
Jesse Glover's user avatar
8 votes
1 answer
3k views

Faster(?) factorial calculations

I saw this question, but was unable to answer because of my inexistant knowledge of Rust, so I decided to try and write an algorithm on my own and put it for review. There is the casual way to ...
IEatBagels's user avatar
  • 12.4k
5 votes
1 answer
12k views

Better implementation of Gaussian Elimination

I made an algorithm in C# that solves any system of linear equations using the Gaussian elimination. There are 2 text boxes in the program for input and output. Input is in the format of the ...
osos95's user avatar
  • 53
1 vote
1 answer
80 views

A banded interpolator, for any type and any interpolation method

This is an extension of my Attributes system I wrote about in these questions: Lvl 1 upgradeable attributes Lvl2 upgradeable attributes It is unrelated to the core functionality under review in ...
Nick Udell's user avatar
  • 5,197
4 votes
2 answers
5k views

Square Root Calculator

I have now written a simple square root calculator using the division method: ...
user avatar
5 votes
4 answers
2k views

Project Euler #5 - Lowest common multiple of 1 through 20

This is my code. All comments welcome. Last time run it only took 335 milliseconds: ...
user avatar
10 votes
8 answers
13k views

Calculate square of a number without multiplication

I wrote these two methods to calculate the square of a number: ...
user avatar
5 votes
3 answers
2k views

Square root implementations

The question was: Write a function that calculates the root of a given number. Answer A = I wrote it for integers. just run up to half of the number Answer B+C = are for double, using Newton's law....
Gilad's user avatar
  • 5,311
6 votes
1 answer
336 views

Immutable Matrix

I'm writing implementations of some numerical methods to solve linear equations systems, those implementations use the following Matrix class. I'm trying to get this class immutable, due to that the ...
enrique7mc's user avatar
4 votes
1 answer
796 views

Project Euler #12 very long runtime

Project Euler Problem 12 asks to find the value of the first triangular number to have over 500 divisors, where the \$n\$th triangular number is \$\sum_{i=1}^{n} i\$. The sequence of triangle ...
cacatpisatmazga's user avatar
10 votes
4 answers
1k views

Solving for the zero of an arbitrary function

This methods solves for the zero of an arbitrary function using the Bisection Method. It works as desired, but I want to know if the code can be improved or made more readable and if I'm properly ...
Ami's user avatar
  • 695
15 votes
3 answers
2k views

Wow that's a big integer! What's its largest prime factor?

I see that there are a few other people who have tackled Project Euler Problem #3. I hope you're not all sick of that question yet. I've not taken a look at those yet (purposely), but am about to now. ...
RubberDuck's user avatar
  • 30.8k

15 30 50 per page