login
A254531
a(n) is the position of the piano key whose frequency is closest to n Hz, start with A0 = the 1st key.
4
1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22
OFFSET
27,3
FORMULA
a(n) = round(12*log_2(n/440)) + 49, 27 <= n <= 4308.
a(A214832(k)) = k for k = 1..88.
EXAMPLE
. | Frequency [Hz] | Piano key | Pitch
. i | f = A079731(i) | a(f) |
. ---+----------------+-----------+------
. 0 | 28 | 1 | A0
. 1 | 55 | 13 | A1
. 2 | 110 | 25 | A2
. 3 | 220 | 37 | A3
. 4 | 440 | 49 | A4 A440
. 5 | 880 | 61 | A5
. 6 | 1760 | 73 | A6
. 7 | 3520 | 85 | A7 .
PROG
(Haskell)
a254531 = (+ 49) . round . (* 12) . logBase 2 . (/ 440) . fromIntegral
(PARI) a(n) = round(12*log(n/440)/log(2))+49 \\ Jianing Song, Oct 14 2019
CROSSREFS
KEYWORD
nonn,fini,full
AUTHOR
Reinhard Zumkeller, Feb 01 2015
EXTENSIONS
Corrected by Jianing Song, Oct 14 2019
STATUS
approved