login
A280916
Number of dashes in International Morse numeral representation of n.
5
5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 8, 7, 6, 5, 4, 3, 4, 5, 6, 7, 9, 8, 7, 6, 5, 4, 5, 6, 7, 8, 14
OFFSET
0,1
COMMENTS
The Morse Code is written in current ITU standard.
FORMULA
a(n) = A316863(A060109(n)) = floor(1+n/10)*5 - A280913(n) = a(floor(n/10)) + a(n%10) if n > 9 or |5 - n| otherwise, where % is the modulo (remainder) operator. - M. F. Hasler, Jun 22 2020
EXAMPLE
For n = 4, the Morse numeral representation of 4 is "....-" i.e., 1 dash. So, a(4) = 1.
For n = 26, the Morse numeral representation of 26 is "..--- -...." i.e, 4 dashes. So, a(26) = 4.
MATHEMATICA
Array[Total@ Map[Abs[# - 5] &, IntegerDigits[#]] &, 101, 0] (* Michael De Vlieger, Jun 28 2020 *)
PROG
(Python)
M={"1":".----", "2":"..---", "3":"...--", "4":"....-", "5":".....", "6":"-....", "7":"--...", "8":"---..", "9":"----.", "0":"-----"}
def A280916(n):
z="".join(M[i] for i in str(n))
return z.count("-")
print([A280916(n) for n in range(100)])
(PARI) apply( {A280916(n)=if(n>9, self()(n\10)+self()(n%10), abs(n-5))}, [0..88]) \\ M. F. Hasler, Jun 22 2020
CROSSREFS
Cf. A060109 (Morse code of n), A280913 (number of dots).
Cf. A006968, A278182 (for Roman resp. Maya representation of n).
Sequence in context: A370427 A022961 A023447 * A307336 A031016 A261302
KEYWORD
nonn,base
AUTHOR
Indranil Ghosh, Jan 10 2017
STATUS
approved