All Questions
Tagged with f# programming-challenge
25
questions
4
votes
1answer
121 views
CodeWars Deodorant Evaporator
How can I make the solution to this https://www.codewars.com/kata/5506b230a11c0aeab3000c1f/train/fsharp more "functional"?
...
2
votes
2answers
91 views
Advent of Code 2019 day 2 in F#
I sped through the 5hr F# pluralsight course this week-end and thought I'd sement my learning by going through as many Advent of Code puzzles I could with this new learning. However, already on day 2 ...
2
votes
1answer
83 views
Project Euler Problem #102 in F#: counting triangles that contain the origin
I've recently decided to get into functional programming with F#, and decided to learn the language through Project Euler. The following is my implementation of problem 102:
Problem:
Three ...
3
votes
2answers
592 views
Advent of Code 2018 day 1 part 2: find the first aggregated number that occures twice
I am using the coding puzzels of https://adventofcode.com for improving my F# skills.
Problem:
Day 1 Part 2:
Starting with frequency 0, a list of numbers should be added successive generating new ...
6
votes
2answers
235 views
Navigating a bounded 2D list (Advent of Code, Day 2: “Bathroom Security”)
I'm trying to solve the following Advent of Code problem in F# for practice.
Description of problem (can be found here):
Basically, there's a 'key pad' that I need to figure the combination to. To ...
2
votes
1answer
587 views
F# Active Pattern with Poker and Playing Cards
From this question and John Palmers answer about active pattern I discovered a gap in my knowledge about F# and took the challenge to code me into some level of understanding this technique.
The ...
8
votes
4answers
7k views
Swap even/odd characters
I wrote some code to solve this problem https://www.hackerrank.com/challenges/string-o-permute which basically states: take an even length string and swap all the even indexed characters. For example ...
3
votes
1answer
264 views
Project Euler Q7 - 10001st prime
The problem is (source)...
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
This is my second attempt at the ...
6
votes
1answer
198 views
Project Euler Q2 - Sum of even Fibonacci numbers
I'm very new at F#, and am using Project Euler to help me learn. Question #2 kept me going for a while, as my initial attempt at an answer was very slow and inelegant. Then I learnt about Seq.unfold, ...
5
votes
1answer
98 views
Solution to Project Euler problem 5 (LCM of 1 to 20)
I'm an experienced C# developer trying to teach myself F#. I spent a day or 3 reading throught the F# wikibook trying to get to know the syntax and F# fundamentals.
As an exercise I'm trying to go ...
5
votes
1answer
157 views
Solving adventcode day 6 puzzle: toggling lights in a grid
I have solved the day 6 adventcode problem:
--- Day 6: Probably a Fire Hazard ---
Because your neighbors keep defeating you in the holiday house
decorating contest year after year, you've ...
9
votes
1answer
678 views
Prime factorization in F#
In the pursuit of learning F#, I have been working through some Project Euler problems.
This is my solution for problem 3:
...
4
votes
1answer
72 views
Finding the largest prime factor
As many people will undoubtedly recognise, this is a question in a well known series of problems that I won't name ;)
It's been a long time since I've written any F# and I'm not sure I've ever come ...
15
votes
4answers
887 views
Project Euler 6: Difference between sum of squares and square of sum
I've created a (very) simple solution for Project Euler problem 6:
Project Euler Problem 6: Sum square difference
The sum of the squares of the first ten natural numbers is,
$$ 1^2 + 2^2 +...
6
votes
1answer
586 views
Project Euler Problems #1-#5
Since I've been playing with F#, I decided to try my hand at implementing some of the Project Euler problems, and I've been having a blast doing it. (f#-is-fun)
So, I'm going to list all the Project ...
2
votes
1answer
96 views
Digit Power Sum with BigInteger
This is my 1st F# program so I'm open to any and all criticism on my syntax and the way I approached the problem.
Challenge
Project Euler 16: Power Digit Sum
2^15 = 32768 and the sum of its digits ...
2
votes
1answer
227 views
Summations and products in F#
I was bored, and looking to do something that involved anonymous functions, and it was suggested by @Quill, that I create a summation function. I decided to also include a product function as well to ...
4
votes
1answer
144 views
Utopian Tree in F#
This is the Utopian Tree in F# (from HackerRank)
The Utopian tree goes through 2 cycles of growth every year. The first
growth cycle of the tree occurs during the monsoon, when it doubles in
...
5
votes
2answers
329 views
Project Euler 3: Getting the largest prime factor of a number
I'm looking for some general feedback on my solution to Project Euler challenge 3
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest
prime factor of the number 600851475143 ?
<...
3
votes
2answers
178 views
Project Euler #2 in F#
Project Euler Problem 2 asks for the sum of all even Fibonacci numbers below 4 million.
My first attempt at this problem using functional programming with F#. I would've liked to use some kind of ...
4
votes
2answers
554 views
Project Euler Problem 1 - Functional approach?
I'm trying to learn F# right now coming from C# and I'm finding it a great difficulty to "reconfigure" my mind to the functional programming mindset. So I'm going to attempt a few Project Euler ...
11
votes
1answer
300 views
Ugly Numbers: A Rags-to-Riches Story
I stumbled upon an unaswered question, which looked like a good fit for a functional programming language.
Here is the problem statement from codeeval:
UGLY NUMBERS
CHALLENGE DESCRIPTION:
...
2
votes
3answers
2k views
Project Euler Problem 7: Find 10001st prime number
I was able to complete the problem, but I would like to improve my code and make it more idiomatic.
Here is the challenge description:
Problem 7 - 10001st prime
By listing the first six ...
5
votes
1answer
1k views
Path sum - Dijkstra's algorithm in F#
I'm learning F# and I've decided to solve Project Euler's Problem #81 with Dijkstra's algorithm.
In the 5 by 5 matrix below, the minimal path sum from the top left to
the bottom right, by only ...
3
votes
1answer
290 views
Euler 2 : Simple Fibonacci
I'm just starting to experiment with F# (from a C# background). I think I'm starting to get into the right way of thinking, but this code still seems pretty awkward. Is there a better (more terse) ...