Skip to content

Instantly share code, notes, and snippets.

View ChristianSiegert's full-sized avatar

Christian Siegert ChristianSiegert

View GitHub Profile
@ChristianSiegert
ChristianSiegert / challenge-2012-10-12.go
Created October 13, 2012 15:57
Solution written in Go for challenge 2012-10-12 on ProgrammingPraxis.com
// The MIT License (MIT)
// Copyright (c) 2012 Christian Siegert
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@ChristianSiegert
ChristianSiegert / challenge-2012-03-23.go
Created June 17, 2012 11:24
Solution written in Go for challenge 2012-03-23 on ProgrammingPraxis.com
// Exercise from: http://programmingpraxis.com/2012/03/23/base-26-arithmetic/
// Exercise: Write a function that takes two base-26 numbers in which digits are represented by letters with A=0, B=1, … Z=25 and returns their product using the same notation. As an example, CSGHJ × CBA = FNEUZJA.
package main
import (
"fmt"
"math"
)
@ChristianSiegert
ChristianSiegert / challenge-2012-03-16.go
Created June 16, 2012 22:30
Solution written in Go for challenge 2012-03-16 on ProgrammingPraxis.com
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println("Exercise from: http://programmingpraxis.com/2012/03/16/sum-of-squares-of-two-largest-of-three-values/")
fmt.Println("Exercise: Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.")
@ChristianSiegert
ChristianSiegert / challenge-2012-05-25.go
Created June 16, 2012 17:49
Solution written in Go for challenge 2012-05-25 on ProgrammingPraxis.com
package main
import (
"fmt"
)
func main() {
fmt.Println("Challenge from: http://programmingpraxis.com/2012/05/25/ackermanns-function/")
fmt.Println("Challenge: Your task is to implement Ackermann’s function.")
fmt.Println("A(3, 4):", A(3, 4))
@ChristianSiegert
ChristianSiegert / challenge-2012-06-15-a.go
Created June 16, 2012 16:47
Solutions written in Go for challenge 2012-06-15 on ProgrammingPraxis.com
package main
import (
"fmt"
"strconv"
)
func main() {
fmt.Println("Question from: http://programmingpraxis.com/2012/06/15/counting-ones/")
fmt.Println("Question: Consider a function f that takes a positive integer n and returns the number of 1s in the decimal representation of all the integers from 0 to n, inclusive. For example, f(13) = 6, for the numbers 1, 10, 11 (twice, for two 1s), 12 and 13. Notice that f(1) = 1. After 1, what is the next largest n for which f(n) = n?")