"Luck May Lie in a Pin" is number 181 in the Hans Christian Andersen Center's register of Andersen's literary works, i.e. no. 181 in the category fairy tale (the range 1 - 300).
"Luck May Lie in a Pin" was first published in English April 1869, cf. the bibliographic description (in Danish) in : H.C. Andersen-Centrets bibliografiske optegnelser:
Luck May Lie in a Pin
The first Danish edition (March 1870): Lykken kan ligge i en Pind. En lille Historie af H. C. Andersen.
The work was published later (30 March 1872) as a part of Nye Eventyr og Historier. Tredie Række. Ny [første] Samling. 1872 [Danish title]. (Number 335. BFN 1017. Category/genre: Fairy tale collection).