pie3636

/r/counting - Usual functions

Oct 17th, 2015 (edited)
2,322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.32 KB | None | 0 0
  1. List of usual functions that can be used for counting:
  2. Got any ideas that aren't listed here? PM me on Reddit (/u/pie3636) and I'll gladly add them!
  3.  
  4. ⇒ Template for symbol copy-pasting :
  5.  
  6. − × ÷ √ ∛
  7. ⌊⌋ ⌈⌉ ||
  8. σ π φ ω Γ Ω µ ζ
  9. 𝜎 𝜋 𝜑 𝜔 𝛤 𝛺 𝜇 𝜁
  10. ⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾
  11. () [] {} <>
  12.  
  13. Last edited 2017/05/07 - Added bitwise AND, OR and XOR.
  14.  
  15. ⇒ Function/Operator Name Link
  16. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  17. Operators
  18. → + Addition https://en.wikipedia.org/wiki/Addition
  19. a + b = a + 1 + 1 + 1 + ... (add 1 "b times" to a, or add 1 "a times" to b). For example, 5 + 2 = 5 + 1 + 1 (adding 2 ones to 5), or 5 + 2 = 2 + 1 + 1 + 1 + 1 + 1 (adding 5 ones to 2)
  20.  
  21. → - − Substraction https://en.wikipedia.org/wiki/Subtraction
  22. a - b = a - 1 - 1 - 1 + ... (take 1 "b times" from a). For example, 5 - 2 = 5 - 1 - 1 (taking 2 ones from 5). Unlike for the addition, a - b is generally different from b - a.
  23.  
  24. → * × x ⋅ Multiplication https://en.wikipedia.org/wiki/Multiplication
  25. a × b = a + a + a + a + ... (add a "b times", or add b "a times"). For example, 5 × 2 = 5 + 5 (adding 2 fives), or 5 × 2 = 2 + 2 + 2 + 2 + 2 (adding 5 twos).
  26.  
  27. → / ÷ : Division https://en.wikipedia.org/wiki/Division
  28. a ÷ b is the number of times you can take b from a until it reaches 0. For example, 12 ÷ 3 = 4 because 12 - 3 - 3 - 3 - 3 = 0 (four times). This is generally different from b ÷ a.
  29.  
  30. → % mod Modulo https://en.wikipedia.org/wiki/Modulo_operation
  31. a % b is the remainder in the integer division of a by b. For example, 17 % 3 = 2 because 17 = 5 * 3 + 2 (17 divided by 3 gives a quotient of 5 and a remainder of 2)
  32.  
  33. → ^ Exponentiation https://en.wikipedia.org/wiki/Exponentiation
  34. a ^ b = a × a × a × a × ... (multiply a "b times"). For example, 2 ^ 3 = 2 × 2 × 2 (multiplying 2 three times), also noted 2³. This is generally different from b ^ a. The convention is that n⁰ is 1. The value of 0⁰ is subject to controversy.
  35.  
  36. → .n Decimal point https://en.wikipedia.org/wiki/Decimal_mark
  37. .2 means 0.2, .5 means 0.5, etc.
  38.  
  39. → n' Repeating decimal https://en.wikipedia.org/wiki/Repeating_decimal
  40. For example, .2' (check the definition of the dot above) is 0.2222..., where the twos are repeated infinitely. This value is also equal to the fraction 2/9. Similarly, .3' = 1/3, etc.
  41.  
  42. → n% Percentage https://en.wikipedia.org/wiki/Percentage
  43. n% is a way to write n / 100. For example, 2% = 2/100 = 0.02.
  44.  
  45. → xy x@y Concatenation https://en.wikipedia.org/wiki/Concatenation
  46. xy means that we append the digits of y to those of x. For example, 7 and 8 can be concatenated into 78, or 52 and 17 into 5217. While it can be noted in several ways, it is advised to just write xy (or x@y for more complex expressions), since the other notations aren't always clear.
  47.  
  48. → ↑^n Knuth's up-arrow https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation
  49. a↑b means a ^ b. a↑↑b (also noted a↑²b) means a ^ a ^ a ^ a ^ ... (repeated b times). a↑↑↑b (noted a↑³b) means a ↑↑ a ↑↑ a ↑↑ a ↑↑ ... (b times), etc. a↑⁰b is equal to a × b (convention).
  50.  
  51. → pt(n) Power tower
  52. pt(n) means n^n. For example, pt(3) means 3^3 = 27.
  53.  
  54. → invert(n), i(n) Multiplicative inverse https://en.wikipedia.org/wiki/Multiplicative_inverse
  55. invert(n) means 1/n. For example, invert(2) is 1/2 = 0.5
  56.  
  57. → AeB, AEB Scientific notation https://en.wikipedia.org/wiki/Scientific_notation
  58. AeB means A × 10^B. For example, 1e3 means 1 × 10³ = 1,000.
  59.  
  60. → <<, >> Bitwise shift https://en.wikipedia.org/wiki/Arithmetic_shift
  61. A << B means A * 2^B. A >> B means floor(A / 2^B). Special cases may arise with large numbers; check the article for more information.
  62.  
  63. → &, &&, AND, ∧ Bitwise AND https://en.wikipedia.org/wiki/Bitwise_operation#AND
  64. A & B is the intersection of the binary representations of A and B. For example, 19 is 10110 and 22 is 10011 in binary, and 10110 & 10011 is 10011 (each digit of the result is 1 if and only if both corresponding digits of A and B were 1s), which is binary for 18. Therefore 19 & 22 = 18. Check http://www.convertforfree.com/bitwise-calculator/ if you don't want to have to make those calculations on your own.
  65.  
  66. → |, ||, OR, ∨ Bitwise OR https://en.wikipedia.org/wiki/Bitwise_operation#OR
  67. A | B is the union of the binary representations of A and B. For example, 9 is 1001 and 10 is 1010 in binary, and 1001 & 1010 is 1011 (each digit of the result is 1 if and only if at least one of the corresponding digits of A and B was a 1), which is binary for 11. Therefore 9 | 10 = 11. Check http://www.convertforfree.com/bitwise-calculator/ if you don't want to have to make those calculations on your own.
  68.  
  69.  
  70. → ¬, ~, NOT, N Bitwise NOT https://en.wikipedia.org/wiki/Bitwise_operation#NOT
  71. ¬A is the negation of the binary representation of A. For example, 9 is 1001, and the negation (binary complement) of 1001 is 0110, or 110 (each digit of the result is 1 if and only if the corresponding digit of A was a 0), which is binary for 6. Therefore ¬9 = 6. Check http://www.convertforfree.com/bitwise-calculator/ if you don't want to have to make those calculations on your own.
  72.  
  73. → ⊕, XOR, ⊻, ↮, ≢ Bitwise XOR https://en.wikipedia.org/wiki/Bitwise_operation#XOR
  74. A | B is the difference of the binary representations of A and B. For example, 9 is 1001 and 10 is 1010 in binary, and 1001 & 1010 is 110 (each digit of the result is 1 if and only if exactly one of the corresponding digits of A and B was a 1), which is binary for 6. Therefore 9 | 10 = 6. Check http://www.convertforfree.com/bitwise-calculator/ if you don't want to have to make those calculations on your own.
  75.  
  76. → () [] {} <> Parenthesing https://en.wikipedia.org/wiki/Order_of_operations
  77. Parenthesing is used to describe the order of operations. For example, if you want to calculate 2 × (3 + 4), you need to calculate the value between parenthesis first : 3 + 4 = 7, then do the remaining multiplication. When in presence of several layers of parenthesis, always begin with the innermost ones.
  78.  
  79. Factorials
  80. → n! Factorial https://en.wikipedia.org/wiki/Factorial
  81. n! = 1 × 2 × 3 × ... × n. For example, 6! = 1 × 2 × 3 × 4 × 5 × 6 = 720. The convention is that 0! = 1.
  82.  
  83. → n!! Double factorial n × (n - 2) × (n - 4) × ... × (either 2 or 1) https://en.wikipedia.org/wiki/Double_factorial
  84. n!! = n × (n - 2) × (n - 4) × ... × (either 2 or 1). For example, 5!! = 5 × 3 × 1 = 15, but 6!! = 6 × 4 × 2 = 48. The multiplication stops when you reach 2 (if n is even) or 1 (if n is odd). This is not to be confused with (n!)!, which is the factorial of n!, that is, the factorial of the factorial of n.
  85.  
  86. → sf(n) n? Superfactorial https://en.wikipedia.org/wiki/Factorial#Superfactorial
  87. sf(n) = 1! × 2! × 3! × 4! × ... × n!. For example, sf(4) = 1! × 2! × 3! × 4! = 288.
  88.  
  89. → H(n) Hyperfactorial https://en.wikipedia.org/wiki/Factorial#Hyperfactorial
  90. H(n) = 1¹ × 2² × 3³ × ... × n^n. For example, H(3) = 1¹ × 2² × 3³ = 108
  91.  
  92. → Γ(n) gamma(n) Gamma function https://en.wikipedia.org/wiki/Gamma_function
  93. Γ(n) is basically (n - 1)! if n is an integer (see: factorial)
  94.  
  95. Trigonometric functions
  96. → sin(n) Sine https://en.wikipedia.org/wiki/Sine
  97. sin(n) can best be described as the y coordinate of the point of the unit circle such as the angle between the x axis, the center of the circle and this point is n. Check the wikipedia article for a better explanation.
  98.  
  99. → cos(n) Cosine https://en.wikipedia.org/wiki/Cosine
  100. cos(n) is the x coordinate of the point of the unit circle defined right above.
  101.  
  102. → tan(n), sec(n), csc(n) and cot(n) or ctg(n) are other functions that can be defined using sin(n) and cos(n). Please check Wikipedia for more information.
  103.  
  104. → arcsin(n) asin(n) asn(n) sin^-1(n) Arcsine https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  105. arcsin is the inverse function of sin, meaning that arcsin(n) is the number x such as sin(x) = n and x belongs to a specific interval.
  106.  
  107. → arccos(n) acos(n) acs(n) cos^-1(n) Arccosine https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  108. arccos is the inverse function of cos (check arcsin for a definition).
  109.  
  110. → arctan(n) atan(n) atn(n) tan^-1(n) Arctangent https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  111. arctan is the inverse function of tan (check arcsin for a definition).
  112.  
  113. → arcsec(n) asec(n) sec^-1(n) Arcsecant https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  114. arcsec is the inverse function of sec (check arcsin for a definition).
  115.  
  116. → arccsc(n) acsc(n) csc^-1(n) Arccosecant https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  117. arccsc is the inverse function of csc (check arcsin for a definition).
  118.  
  119. → arccot(n) acot(n) cot^-1(n) ctg^-1(n) Arccotangent https://en.wikipedia.org/wiki/Inverse_trigonometric_functions
  120. arccot is the inverse function of cot (check arcsin for a definition).
  121.  
  122.  
  123. General functions
  124. → exp(n) Exponential function https://en.wikipedia.org/wiki/Exponential_function
  125. exp(n) = e^n, where e ~ 2.718281828. exp(a + b) = exp(a) × exp(b), and exp(ab) = exp(a) ^ b. a ^ b can also be noted exp(b × ln(a)).
  126.  
  127. → ln(n) Logarithm https://en.wikipedia.org/wiki/Logarithm
  128. ln is the inverse function of exp (check arcsin for a definition). ln(a × b) = ln(a) + ln(b), and ln(a ^ b) = b × ln(a).
  129.  
  130. → log(n) log10(n) lg(x) Common logarithm https://en.wikipedia.org/wiki/Common_logarithm
  131. log(n) is ln(n)/ln(10). For example, log(10) = 1, log(100) = 2 and log(1000) = 3.
  132.  
  133. → √n sqrt(n) Square root https://en.wikipedia.org/wiki/Square_root
  134. √n is the only positive number so that √n × √n = n. For example, √9 = 3 because 3 × 3 = 9.
  135.  
  136. → ∛n cbrt(n) Cube root https://en.wikipedia.org/wiki/Cube_root
  137. ∛n is the only positive number so that ∛n × ∛n × ∛n = n. For example, ∛8 = 2 because 2 × 2 × 2 = 8.
  138.  
  139. → |n| abs(n) Absolute value https://en.wikipedia.org/wiki/Absolute_value
  140. |n| is the only positive value of n and -n. If n > 0, then |n| = n, otherwise |n| = -n. Another way to put it is that |n| is n after you 'drop' the sign (+ or ─) before it.
  141.  
  142. → floor(n) ⌊n⌋ Floor function https://en.wikipedia.org/wiki/Floor_and_ceiling_functions
  143. ⌊n⌋ is the integer right before n (included). For example, ⌊5⌋ = 5, and ⌊4.5⌋ = 4. Another way to put is is that ⌊n⌋ is n after you dropped the part after the decimal point.
  144.  
  145. → ceil(n) ⌈n⌉ Ceiling function https://en.wikipedia.org/wiki/Floor_and_ceiling_functions
  146. ⌈n⌉ is the integer right after n (included). For example, ⌈5⌉ = 5, and ⌈4.5⌉ = 5. Another way to put is is that ⌈n⌉ is n if n is an integer, otherwise it's n + 1.
  147.  
  148. → A(n) Ackermann function https://en.wikipedia.org/wiki/Ackermann_function
  149. A complicated function (check the Wikipedia article if you want to know the definition). There are only a couple interesting values of this function, see below.
  150.  
  151. → R(n) Backwards function
  152. R(n) is n written backwards. For example, R(123456) = 654321, R(598) = 895, etc.
  153.  
  154. → p(n) Partition function https://en.wikipedia.org/wiki/Partition_(number_theory)
  155. p(n) is the number of partitions of n, meaning the number of ways to decompose n into a sum of integers. For example, 4 can be written as (1 + 1 + 1 + 1), (1 + 1 + 2), (1 + 3), (2 + 2), and (4). There are 5 partitions of 4, therefore p(4) = 5.
  156.  
  157. → µ(n) mu(n) Möbius function https://en.wikipedia.org/wiki/M%C3%B6bius_function
  158. Another complicated function, check the link to know more.
  159.  
  160. → sgn(n) Sign function https://en.wikipedia.org/wiki/Sign_function
  161. sgn(n) is 0 if n = 0, 1 if n is positive, and -1 if n is negative. For example, sgn(5) = sgn(8) = 1, but sgn(-3) = sgn(-7) = -1.
  162.  
  163. → F(n) Fibonacci sequence https://en.wikipedia.org/wiki/Fibonacci_number
  164. F(0) = 0, F(1) = 1. The other values are constructed by adding the two previous ones. For example, F(2) = F(1) + F(0) = 1, F(3) = F(2) + F(1) = 2, etc.
  165.  
  166. → T(n) Tribonacci sequence https://en.wikipedia.org/wiki/Generalizations_of_Fibonacci_numbers#Tribonacci_numbers
  167. T(0) = 0, T(1) = 0, and T(2) = 1. The other values are constructed by adding the three previous ones. For example, T(3) = T(2) + T(1) + T(0) = 1, T(4) = T(3) + T(2) = T(1) = 2, etc.
  168.  
  169. → C(n) Catalan numbers https://en.wikipedia.org/wiki/Catalan_number
  170. C(n) = (2n)!/((n+1)n!)
  171.  
  172. → B(n, k) Binomial coefficient https://en.wikipedia.org/wiki/Binomial_coefficient
  173. B(n, k) = n!/(k!(n-k)!)
  174.  
  175. → binarybeanstalk(n) OEIS Sequence A179016 http://oeis.org/A179016
  176. This is an obscure sequence so that s(0) = 0, and the other values are computer so that s(n) = s(n-1) + [the number of ones in the binary representation of s(n)].
  177.  
  178. Primes
  179. → σ(n) sigma(n) Divisor function https://en.wikipedia.org/wiki/Divisor_function
  180. σ(n) is the sum of all the divisors of n. For example, the divisors of 6 are 1, 2, 3 and 6 (because 6 = 1 × 6 = 2 × 3), therefore σ(6) = 1 + 2 + 3 + 6 = 12.
  181.  
  182. → σ_x(n) sigma_x(n) Divisor function https://en.wikipedia.org/wiki/Divisor_function
  183. σ_x(n) is just like σ(n), except that each divisor is taken to the power of x before being added. For example, σ_3(6) = 1³ + 2³ + 3³ + 6³ = 252.
  184.  
  185. → s(n) Divisor function https://en.wikipedia.org/wiki/Divisor_function
  186. s(n) is the sum of all the divisors of n but n, meaning that s(n) = σ(n) - n. For example, s(6) = 1 + 2 + 3 = 6.
  187.  
  188. → d(n) Divisor function https://en.wikipedia.org/wiki/Divisor_function
  189. d(n) is the number of divisors of n. For example, 6 is divisible by 1, 2, 3 and 6, therefore d(6) = 4 (there are 4 divisors).
  190.  
  191. → π(n) pi(n) https://en.wikipedia.org/wiki/Prime-counting_function
  192. π(n) is how many numbers are lesser than n and are primes. For example, 2, 3, 5, 7 and 11 are the only primes that are lesser than 12, therefore π(12) = 5. The page https://en.wikipedia.org/wiki/List_of_prime_numbers might help compute those values.
  193.  
  194. → P(n) https://en.wikipedia.org/wiki/Formula_for_primes
  195. P(n) is the nth prime number, starting with P(1) = 2. For example, P(5) = 11. A prime is a number which has exactly 2 divisors, 1 and itself. 1 isn't considered a prime, but 2 is (2 = 1 × 2), and 4 isn't (4 is divisible by 1, 2 and 4). The page https://en.wikipedia.org/wiki/List_of_prime_numbers gives a list of the first values of P(n).
  196.  
  197. → nonprime(n) composite(n) Nonprime function https://en.wikipedia.org/wiki/Composite_number
  198. nonprime(n) is the nth nonprime number. For example, n(4) = 9 because 4, 6, 8 and 9 are the first nonprimes (1 is not considered a composite number, despite not being a prime either).
  199.  
  200. → φ(n) phi(n) Totient function https://en.wikipedia.org/wiki/Euler's_totient_function
  201. φ(n) is how many numbers lesser than n are relatively prime to n, meaning that they share no common divisor with n aside from 1. For example, 2 is relatively prime to 7 but no to 8 (2 and 8 are both divisible by 2). For example, φ(4) = 2 because 1 and 3 are relatively prime to 4, but 2 isn't.
  202.  
  203. → sumtotient(n) http://oeis.org/A002088
  204. sumtotient(n) is the sum of the n first value of φ(n). For example, sumtotient(4) = φ(1) + φ(2) + φ(3) + φ(4) = 6.
  205.  
  206. → ω(n) omega(n) Distinct prime factors https://en.wikipedia.org/wiki/Prime_factor#Omega_function
  207. ω(n) is the number of distinct prime factors of n. For example, 12 can be decomposed (like any composite number) into the product of primes 2 × 2 × 3, and there are two different primes, therefore ω(12) = 2.
  208.  
  209. → Ω(n) Omega(n) Prime factors https://en.wikipedia.org/wiki/Prime_factor#Omega_function
  210. Ω(n) is the number of total prime factors of n. For example, 12 can be decomposed into the product of primes 2 × 2 × 3, and there are three terms, therefore Ω(12) = 3.
  211.  
  212. → ζ(n) zeta(n) Riemann zeta function https://en.wikipedia.org/wiki/Riemann_zeta_function
  213. zeta(n) is defined as the sum of (the inverse of all natural numbers raised to the nth power). For example, zeta(2) = 1 + 1/2² + 1/3² + ... = π²/12. This is an important and famous function.
  214.  
  215. → p_n# Primorial https://en.wikipedia.org/wiki/Primorial
  216. p_n# is the product of the n first primes. For example, p_4# = P(1) × P(2) × P(3) × P(4) = 2 × 3 × 5 × 7 = 210.
  217.  
  218. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  219. Functionality :
  220. Here are a list of useful values for the functions above. If you don't know how to find the solution to a number, try looking at these. Another common approach is to find the prime factors of the number you're trying to reach, and to then obtain those numbers, which is often easier.
  221.  
  222. arcsin(1) = 90
  223. arcsin(1/2) = 30
  224. arccos(0) = 90
  225. arccos(1/2) = 60
  226. arctan(1) = 45
  227. http://functions.wolfram.com/ElementaryFunctions/ArcSec/03/01/
  228. http://functions.wolfram.com/ElementaryFunctions/ArcCsc/03/01/
  229. http://functions.wolfram.com/ElementaryFunctions/ArcCot/03/01/
  230.  
  231. sgn(n > 0) = 1
  232.  
  233. 2↑↑3 = 16
  234. 3↑↑2 = 27
  235.  
  236. A (n, m) → n │ 0 1 2 3 4 5 6 7 8 9
  237. ↓ m ──────────┼──────────────────────────────────────────────────────────────────────────────
  238. 1 │ 2 3 4 5 6 7 8 9 10 11
  239. 2 │ 3 5 7 9 11 13 15 17 18 19
  240. 3 │ 5 13 29 61 125 253 509 1019 2045 4093
  241. 4 │ 13
  242.  
  243. n 1 2 3
  244. A(n) 3 7 61
  245. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  246. n 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  247. F(n) 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
  248. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  249. n 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  250. T(n) 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 5768
  251. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  252. n 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
  253. p(n) 2 3 5 7 11 15 22 30 42 56 77 101 135 176 231 297 385 490 627
  254.  
  255. n 21 22 23 24 25 26 27 28 29
  256. p(n) 792 1002 1255 1575 1958 2436 3010 3718 4565
  257. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  258. n 3 4 5 6 7 8 9
  259. C(n) 5 14 42 132 429 1430 4862
  260. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  261. n 1 2 3 4 5
  262. p#n 2 6 30 210 2310
  263. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  264. n 3 4 5 6 7
  265. n! = Γ(n+1) 6 24 120 720 5040
  266. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  267. n 4 5 6 7 8 9 10
  268. n!! 8 15 48 105 384 945 3840
  269. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  270. n 3 4
  271. sf(n) 12 288
  272. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  273. n 2 3
  274. H(n) 3 108
Add Comment
Please, Sign In to add comment