LilyPond = LaTex for Music!!

LaTeX is used to format math and science papers.  It is a markup language (similar to what HTML is for the web).

LilyPond (LilyPond.org) is a markup language for writing musical scores.

 

text-input-1-annotate

 

Fescobaldi (www.frescobaldi.org/)is a Python program that makes it easy to write the LilyPond code and see the resulting script.

 

 

Find all Palindromes between 1 and 10,000 in multiple bases

 

# Find all numbers between 1 to 10,000 which are palindromes in more than one base

def digit_to_char(digit):
    if digit < 10:
        return str(digit)
    return chr(ord('a') + digit - 10)

def str_base(number,base):
    if number < 0:
        return '-' + str_base(-number, base)
    (d, m) = divmod(number, base)
    if d > 0:
        return str_base(d, base) + digit_to_char(m)
    return digit_to_char(m)



for S in range(1, 10001):
    n = 0
    S += 1
    palindromeCount = 0
    msg = ""
    for B in range(2,11):
        inBaseB = str_base(S, B)
        if inBaseB == inBaseB[::-1]:
            msg += " base " + str(B) + ": " + inBaseB + ";"
            palindromeCount += 1
    if palindromeCount >= 2:
        print(str(S) + "(" + msg + " )")
        
2( base 3: 2; base 4: 2; base 5: 2; base 6: 2; base 7: 2; base 8: 2; base 9: 2; base 10: 2; )
3( base 2: 11; base 4: 3; base 5: 3; base 6: 3; base 7: 3; base 8: 3; base 9: 3; base 10: 3; )
4( base 3: 11; base 5: 4; base 6: 4; base 7: 4; base 8: 4; base 9: 4; base 10: 4; )
5( base 2: 101; base 4: 11; base 6: 5; base 7: 5; base 8: 5; base 9: 5; base 10: 5; )
6( base 5: 11; base 7: 6; base 8: 6; base 9: 6; base 10: 6; )
7( base 2: 111; base 6: 11; base 8: 7; base 9: 7; base 10: 7; )
8( base 3: 22; base 7: 11; base 9: 8; base 10: 8; )
9( base 2: 1001; base 8: 11; base 10: 9; )
10( base 3: 101; base 4: 22; base 9: 11; )
15( base 2: 1111; base 4: 33; )
16( base 3: 121; base 7: 22; )
17( base 2: 10001; base 4: 101; )
18( base 5: 33; base 8: 22; )
20( base 3: 202; base 9: 22; )
21( base 2: 10101; base 4: 111; base 6: 33; )
24( base 5: 44; base 7: 33; )
26( base 3: 222; base 5: 101; )
27( base 2: 11011; base 8: 33; )
28( base 3: 1001; base 6: 44; )
31( base 2: 11111; base 5: 111; )
33( base 2: 100001; base 10: 33; )
36( base 5: 121; base 8: 44; )
40( base 3: 1111; base 7: 55; base 9: 44; )
45( base 2: 101101; base 8: 55; )
46( base 4: 232; base 5: 141; )
50( base 7: 101; base 9: 55; )
51( base 2: 110011; base 4: 303; )
52( base 3: 1221; base 5: 202; )
55( base 4: 313; base 6: 131; base 10: 55; )
57( base 5: 212; base 7: 111; )
63( base 2: 111111; base 4: 333; base 8: 77; )
65( base 2: 1000001; base 4: 1001; base 8: 101; )
67( base 5: 232; base 6: 151; )
73( base 2: 1001001; base 8: 111; )
78( base 5: 303; base 7: 141; )
80( base 3: 2222; base 6: 212; base 9: 88; )
82( base 3: 10001; base 9: 101; )
85( base 2: 1010101; base 4: 1111; base 7: 151; )
88( base 5: 323; base 10: 88; )
91( base 3: 10101; base 9: 111; )
92( base 6: 232; base 7: 161; )
93( base 2: 1011101; base 5: 333; )
98( base 5: 343; base 6: 242; )
99( base 2: 1100011; base 10: 99; )
100( base 3: 10201; base 7: 202; base 9: 121; )
104( base 5: 404; base 6: 252; )
105( base 4: 1221; base 8: 151; )
107( base 2: 1101011; base 7: 212; )
109( base 5: 414; base 9: 131; )
111( base 6: 303; base 10: 111; )
114( base 5: 424; base 7: 222; )
119( base 2: 1110111; base 5: 434; )
121( base 3: 11111; base 7: 232; base 8: 171; base 10: 121; )
127( base 2: 1111111; base 9: 151; )
129( base 2: 10000001; base 6: 333; )
130( base 3: 11211; base 4: 2002; base 8: 202; )
135( base 6: 343; base 7: 252; )
141( base 6: 353; base 10: 141; )
142( base 3: 12021; base 7: 262; )
150( base 4: 2112; base 7: 303; )
151( base 3: 12121; base 10: 151; )
154( base 6: 414; base 8: 232; base 9: 181; )
160( base 3: 12221; base 6: 424; )
164( base 3: 20002; base 7: 323; base 9: 202; )
170( base 4: 2222; base 8: 252; )
171( base 7: 333; base 10: 171; )
173( base 3: 20102; base 9: 212; )
178( base 6: 454; base 7: 343; base 8: 262; )
182( base 3: 20202; base 9: 222; )
185( base 6: 505; base 7: 353; )
186( base 5: 1221; base 8: 272; )
191( base 6: 515; base 9: 232; base 10: 191; )
195( base 2: 11000011; base 4: 3003; base 8: 303; )
200( base 7: 404; base 9: 242; )
203( base 3: 21112; base 6: 535; base 8: 313; )
209( base 6: 545; base 9: 252; )
212( base 3: 21212; base 10: 212; )
215( base 4: 3113; base 6: 555; )
219( base 2: 11011011; base 8: 333; )
227( base 8: 343; base 9: 272; )
235( base 4: 3223; base 7: 454; base 8: 353; )
242( base 3: 22222; base 7: 464; base 10: 242; )
246( base 5: 1441; base 9: 303; )
252( base 5: 2002; base 10: 252; )
255( base 2: 11111111; base 4: 3333; base 9: 313; )
257( base 2: 100000001; base 4: 10001; base 7: 515; )
264( base 7: 525; base 9: 323; )
273( base 2: 100010001; base 4: 10101; base 9: 333; )
282( base 5: 2112; base 9: 343; base 10: 282; )
292( base 7: 565; base 8: 444; base 10: 292; )
300( base 7: 606; base 8: 454; base 9: 363; )
313( base 2: 100111001; base 10: 313; )
316( base 3: 102201; base 8: 474; )
325( base 2: 101000101; base 4: 11011; base 8: 505; )
328( base 3: 110011; base 7: 646; base 9: 404; )
333( base 8: 515; base 10: 333; )
341( base 2: 101010101; base 4: 11111; base 8: 525; )
342( base 5: 2332; base 7: 666; )
343( base 6: 1331; base 10: 343; )
357( base 4: 11211; base 8: 545; )
364( base 3: 111111; base 9: 444; )
365( base 2: 101101101; base 8: 555; )
373( base 4: 11311; base 8: 565; base 9: 454; base 10: 373; )
381( base 2: 101111101; base 8: 575; )
393( base 4: 12021; base 10: 393; )
400( base 3: 112211; base 7: 1111; base 9: 484; )
414( base 8: 636; base 10: 414; )
427( base 2: 110101011; base 6: 1551; )
434( base 6: 2002; base 10: 434; )
438( base 5: 3223; base 8: 666; )
446( base 8: 676; base 9: 545; )
455( base 2: 111000111; base 8: 707; base 9: 555; )
464( base 9: 565; base 10: 464; )
471( base 2: 111010111; base 8: 727; )
484( base 3: 122221; base 10: 484; )
495( base 2: 111101111; base 8: 757; )
511( base 2: 111111111; base 8: 777; )
513( base 2: 1000000001; base 8: 1001; )
546( base 4: 20202; base 9: 666; )
555( base 9: 676; base 10: 555; )
560( base 3: 202202; base 6: 2332; )
564( base 5: 4224; base 9: 686; )
585( base 2: 1001001001; base 8: 1111; base 10: 585; )
624( base 5: 4444; base 7: 1551; )
626( base 5: 10001; base 10: 626; )
644( base 3: 212212; base 6: 2552; )
646( base 9: 787; base 10: 646; )
651( base 5: 10101; base 6: 3003; )
656( base 3: 220022; base 9: 808; base 10: 656; )
666( base 4: 22122; base 10: 666; )
676( base 5: 10201; base 10: 676; )
692( base 3: 221122; base 9: 848; )
693( base 2: 1010110101; base 6: 3113; )
701( base 5: 10301; base 9: 858; )
717( base 2: 1011001101; base 10: 717; )
728( base 3: 222222; base 9: 888; )
730( base 3: 1000001; base 9: 1001; )
757( base 3: 1001001; base 10: 757; )
771( base 2: 1100000011; base 4: 30003; )
777( base 6: 3333; base 10: 777; )
787( base 4: 30103; base 10: 787; )
819( base 2: 1100110011; base 4: 30303; base 6: 3443; )
820( base 3: 1010101; base 9: 1111; )
856( base 5: 11411; base 7: 2332; )
868( base 6: 4004; base 10: 868; )
910( base 3: 1020201; base 6: 4114; base 9: 1221; )
939( base 4: 32223; base 10: 939; )
975( base 2: 1111001111; base 4: 33033; )
1023( base 2: 1111111111; base 4: 33333; )
1025( base 2: 10000000001; base 4: 100001; )
1066( base 3: 1110111; base 5: 13231; )
1105( base 2: 10001010001; base 4: 101101; )
1221( base 5: 14341; base 10: 1221; )
1285( base 2: 10100000101; base 4: 110011; )
1312( base 3: 1210121; base 7: 3553; )
1365( base 2: 10101010101; base 4: 111111; )
1432( base 5: 21212; base 7: 4114; )
1441( base 6: 10401; base 10: 1441; )
1460( base 3: 2000002; base 9: 2002; )
1539( base 2: 11000000011; base 8: 3003; )
1550( base 3: 2010102; base 9: 2112; )
1640( base 3: 2020202; base 9: 2222; )
1667( base 3: 2021202; base 5: 23132; )
1755( base 2: 11011011011; base 8: 3333; )
1885( base 4: 131131; base 6: 12421; )
2000( base 7: 5555; base 9: 2662; )
2188( base 3: 10000001; base 5: 32223; )
2268( base 5: 33033; base 8: 4334; )
2293( base 5: 33133; base 6: 14341; )
2550( base 4: 213312; base 9: 3443; )
2565( base 2: 101000000101; base 8: 5005; )
2709( base 2: 101010010101; base 5: 41314; base 8: 5225; )
2730( base 4: 222222; base 9: 3663; )
2910( base 4: 231132; base 9: 3883; )
2920( base 3: 11000011; base 9: 4004; )
2925( base 2: 101101101101; base 8: 5555; )
2997( base 7: 11511; base 8: 5665; )
3069( base 2: 101111111101; base 8: 5775; )
3074( base 5: 44244; base 6: 22122; )
3075( base 2: 110000000011; base 4: 300003; )
3280( base 3: 11111111; base 9: 4444; )
3315( base 2: 110011110011; base 4: 303303; )
3550( base 7: 13231; base 9: 4774; )
3591( base 2: 111000000111; base 8: 7007; )
3640( base 3: 11222211; base 9: 4884; )
3663( base 8: 7117; base 10: 3663; )
3735( base 2: 111010010111; base 8: 7227; )
3740( base 6: 25152; base 9: 5115; )
3855( base 2: 111100001111; base 4: 330033; )
3951( base 2: 111101101111; base 8: 7557; )
3999( base 2: 111110011111; base 6: 30303; )
4095( base 2: 111111111111; base 4: 333333; base 8: 7777; )
4097( base 2: 1000000000001; base 4: 1000001; base 8: 10001; )
4161( base 2: 1000001000001; base 4: 1001001; base 8: 10101; )
4225( base 4: 1002001; base 8: 10201; )
4257( base 2: 1000010100001; base 6: 31413; )
4289( base 4: 1003001; base 8: 10301; )
4369( base 2: 1000100010001; base 4: 1010101; )
4433( base 2: 1000101010001; base 4: 1011101; )
4593( base 2: 1000111110001; base 6: 33133; )
4617( base 2: 1001000001001; base 8: 11011; )
4681( base 2: 1001001001001; base 8: 11111; )
5001( base 6: 35053; base 8: 11611; )
5049( base 2: 1001110111001; base 7: 20502; )
5125( base 2: 1010000000101; base 4: 1100011; )
5189( base 2: 1010001000101; base 4: 1101011; )
5397( base 2: 1010100010101; base 4: 1110111; )
5461( base 2: 1010101010101; base 4: 1111111; )
5740( base 6: 42324; base 9: 7777; )
5840( base 3: 22000022; base 9: 8008; )
5854( base 6: 43034; base 7: 23032; )
6148( base 6: 44244; base 7: 23632; )
6200( base 3: 22111122; base 9: 8448; )
6560( base 3: 22222222; base 9: 8888; )
6562( base 3: 100000001; base 9: 10001; )
6643( base 2: 1100111110011; base 3: 100010001; base 9: 10101; )
6697( base 4: 1220221; base 8: 15051; )
6724( base 3: 100020001; base 9: 10201; )
6761( base 4: 1221221; base 8: 15151; )
6825( base 4: 1222221; base 8: 15251; )
6886( base 9: 10401; base 10: 6886; )
6889( base 4: 1223221; base 8: 15351; )
6953( base 7: 26162; base 8: 15451; )
7300( base 3: 101000101; base 9: 11011; )
7373( base 4: 1303031; base 6: 54045; )
7381( base 3: 101010101; base 9: 11111; )
7409( base 6: 54145; base 8: 16361; )
7447( base 2: 1110100010111; base 10: 7447; )
7462( base 3: 101020101; base 9: 11211; )
7517( base 4: 1311131; base 6: 54445; )
7667( base 6: 55255; base 10: 7667; )
7703( base 6: 55355; base 7: 31313; )
7777( base 6: 100001; base 10: 7777; )
7801( base 7: 31513; base 8: 17171; )
7997( base 4: 1330331; base 10: 7997; )
8038( base 3: 102000201; base 9: 12021; )
8119( base 3: 102010201; base 9: 12121; )
8194( base 4: 2000002; base 8: 20002; )
8200( base 3: 102020201; base 7: 32623; base 9: 12221; )
8258( base 4: 2001002; base 8: 20102; )
8281( base 6: 102201; base 9: 12321; )
8322( base 4: 2002002; base 8: 20202; )
8386( base 4: 2003002; base 8: 20302; )
8578( base 3: 102202201; base 8: 20602; )
8778( base 8: 21112; base 10: 8778; )
8802( base 4: 2021202; base 7: 34443; )
9009( base 2: 10001100110001; base 10: 9009; )
9103( base 3: 110111011; base 7: 35353; )
9201( base 2: 10001111110001; base 7: 35553; )
9222( base 4: 2100012; base 5: 243342; )
9490( base 3: 111000111; base 8: 22422; )
9958( base 4: 2123212; base 7: 41014; )

 

 

 

 

Coding Contests and other Python resources

 

I have been looking at some of the various contest problems.  Every year HP sponsors a contest called HP CodeWars and looking through some of the problems, the kids should be able to solve some (with minor modifications of the problems) today.  I have printed out a handful which we can give to the kids that are further ahead to keep them engaged.  We can also integrate them into future lessons as well:
Here are some other contest problems that we can use or get ideas from:
American Computer Science League: http://www.hpcodewars.org/index.php?page=samples
Cornell University High School Programming Contest: http://www.cs.cornell.edu/home/rvr/ProgrammingContest2015.pdf
USA Computing Olympiad: http://www.usaco.org/index.php?page=resources
Proco: http://proco.stanford.edu/2009/
UIL Computer Science: http://www.uiltexas.org/academics/computer-science
Battle of the Brains: http://www.utdallas.edu/k12/contest/
Other Python Resources:
Tying in Robotics using Raspberry Pi:
OpenCV using Python: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_tutorials.html
Communicating to the Arduino in Python: http://playground.arduino.cc/Interfacing/Python
Running Python on the Arduino (Python on a chip): http://playground.arduino.cc/CommonTopics/PyMite
Python related Arduino lessons: http://www.toptechboy.com/using-python-with-arduino-lessons/
Understanding Internet protocols by building servers/clients:
Sockets overview and creating an Echo server: http://www.bogotobogo.com/python/python_network_programming_server_client.php
Build a webserver in Python: http://ruslanspivak.com/lsbaws-part1/
Webclient (extremely simple): http://stackoverflow.com/questions/4220601/writing-a-small-yet-flexible-http-client
Python Chat server: http://www.ibm.com/developerworks/linux/tutorials/l-pysocks/
Creating web applications in Python (review of options and frameworks):
Leave a comment with Python resources you think I should check out.

 

The Interstellar Team

Here are some of the grand prize entries from previous years:

See more at: http://settlement.arc.nasa.gov/Contest/

First Python Class for kids

A fellow parent and I are working on putting together a Python class for our middle school children.  In the first lesson, planning to cover:

  • Install Python on your computer
  • Using IDLE interactively to explore
    • String
    • Variables
    • if/else
    • while
    • Boolean logic
    • Integers
  • Create Python files

Here is the PowerPoint file we have so far:

Tutorial01-basic-NathanEdits (1)

 

“Lean On”

Lean On” is a song recorded by American EDM group Major Lazer and French producer DJ Snake for Major Lazer’s third studio album, Peace Is the Mission (2015), featuring vocals from Danish singer . It was produced by Major Lazer and DJ Snake, and written by MØ, Major Lazer member Diplo, DJ Snake, Jr. Blender and Martin Bresso.[1] “Lean On” was released through Mad Decent independently (Because Music for Europe, WMG for Australia) as the lead single from the album on March 1, 2015.[2] It is a dancehall[3] and electronic song being also described as a house music ballad.[4][5]

“Lean On” was a commercial success, peaking at number 4 on the Billboard Hot 100 and at number 2 on the UK Singles Chart. It reached number one in several other countries including Australia, Ireland, the Netherlands, New Zealand, Denmark and Switzerland. The accompanying music video for “Lean On” was filmed in ND Studios, Karjat and Kaul Heritage City, Vasai in Maharashtra, India, and premiered on March 23, 2015.

It was chosen as the official song of 2017 FIFA U-17 World Cup

[From Wikipedia: en.wikipedia.org/wiki/Lean_On]

One of my interests lately has been dance.  I recently joined the YMCA and have really enjoyed the Zumba and BodyJam classes.  Simultaneously, I came across a Danish singer by the name of MØ and her song “Lean On”.  In checking out the song I ran across the music video, which was filmed in India.  Needless to say, with my site ISpeakHindi.com I found that to be interesting.

The choreographed by Paresh Shirodkar.  (Facebook)

Here is another instructional video that walks through the dance in a lot more steps and more complete.

 

Here the perform the complete dance. (keep an eye out for the dog that wonders on set and magically disappears 🙂 )

A few more videos:

On the streets:

 

Here is one that shows a week to week improvement of a dance group:

Other singers:

Benjamin Zander: The transformative power of classical music

Two sales men go to Africa in the late 1800s to see if there is an potential to sell shoes.  One of them telegraphs back (telegraph here does not refer to an iPhone app, but rather a mode of communication the predates the internet, which didn’t always exist), “There is no potential here, no one wears shoes.”

The other salesman telegraphs back, “- …. . .-. . / .. … / .- / …. ..- –. . / — .–. .–. — .-. – ..- -. .. – -.– / …. . .-. . .-.-.-”  (morsecode.scphillips.com/translator.html)

Likewise, there are only about 3% of the population that listens to Classical Music.  Some in the industry say if they could just get it up to 4% then the industry would be saved and that there would not be an further orchestra closings.  But Benjamin Zander proposes that maybe many more people (most people) would like classical music, but they just do not know it yet.

Take a look at his TED talk and let me know what you think.

 

Project Soli – Google project to put jester sensor on a single chip

 

Understanding Project Soli:

www.anandtech.com/show/9300/understanding-project-soli-and-jacquard

 

Never “too busy”

I just read a great article on TheNextWeb: thenextweb.com/entrepreneur/2015/05/30/too-busy-two-little-words-one-big-lie/

Starts with:

I’ve never heard of a highly creative or successful person being too busy. Let me rephrase that: I’ve never heard of a highly creative or successful person that I respect being too busy.

Ends with:

I’m an entrepreneur who isn’t willing to live someone else’s life. I measure my success by the things that make me happy, not by things that are glorified by our society.

Stop being busy. Start being honest with yourself. Make changes in your life. It will be scary, but it will be worth it.

With a lot of good advice and observations in between… definitely worth reading.

Biologists having fun

PCR:

 

Gene regulator rap

 

Caught in a Bad Project (Lady Gaga Parody)

 

Lab Slaves (“Royals” Undergraduate Biology Parody)