package
0.0.0-20240709032709-1a9f1573a399
Repository: https://github.com/samiam2013/learngo.git
Documentation: pkg.go.dev

# README

Elementary

Simple exercises from adriann.github.io/programming_problems.html (CC-BY-SA)

  1. Write a program that prints ‘Hello World’ to the screen.✔️
  2. Write a program that asks the user for their name and greets them with their name.✔️
  3. Modify the previous program such that only the users Alice and Bob are greeted with their names.✔️
  4. Write a program that asks the user for a number n and prints the sum of the numbers 1 to n✔️
  5. Modify the previous program such that only multiples of three or five are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17✔️
  6. Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1,…,n.✔️
  7. Write a program that prints a multiplication table for numbers up to 12.✔️
  8. Write a program that prints all prime numbers. (Note: if your programming language does not support arbitrary size numbers, printing all primes up to the largest number you can easily represent is fine too.)✔️
  9. Write a guessing game where the user has to guess a secret number. After every guess the program tells the user whether their number was too large or too small. At the end the number of tries needed should be printed. It counts only as one try if they input the same number multiple times consecutively.✔️
  10. Write a program that prints the next 20 leap years.✔️
  11. Write a program that computes the sum of an alternating series where each element of the series is an expression of the form ((-1)^{k+1})/(2 * k-1) for each value of k from 1 to a million, multiplied by 4. Or, in more mathematical notation 4\cdot \sum_{k=1}^{10^6} \frac{(-1)^{k+1}}{2k-1} = 4\cdot(1-1/3+1/5-1/7+1/9-1/11\ldots).✔️

# Functions

AlternatingSeries computes the series in exercise 11 and prints the reuslt.
AlternatingSeries computes the series in exercise 11 and prints the reuslt.
CheckBigPrime tells you if a go arbitrary in is prime.
Factorial does the ! math thing.
FizzBuzz takes a limit number of iterations and a test flag for returning a string rather than printing and returning "".
FizzBuzzSum : 5.
GreetBobOrAlice :.
GreetName : 2.
GuessingGame implements the exercise 9 prompt.
HelloWorld : 1.
IsAnagram compares two strings by sorting them and comparing.
IsAnagramFast compares two strings by counting chars in a map.
MultiplicationTable prints a 12 by 12 left-padded mult.
Next20LeapYears dynamically gets the current year and calculates.
PrimeSeiveP prints an infinite number of primes takes an int64 that represents a limit, -1 for no limit.
PrintPrimeSeive prints an infinite number of primes takes an int64 that represents a limit, -1 for no limit takes a bool value to either print or simply run.
PrintPrimeSeiveP prints a given number of big.Ints, streaming from PrimeSeiveP().
SumFunction gets the FizzBuzzSum of a number.
TriangleOrFac : 6 Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1,…,n.
TriangleSum : 4.
Σ computes the triangle sum (1 + 2 +..+ n) of a number n.