In most cases, I would recommend that you follow alexwlchan's suggestion. However, if you're entering lots of numbers at once and would rather not have to hold down the fn key, there is another solution: creating a custom keyboard layout!
The free app Ukelele enables this to be done fairly painlessly. Simply place the numbers and any other keys you want to have access to, and select
File > Install > Install For [Current User/All Users].
Once the layout is installed, add it to your input sources in
> System Preferences > Keyboard > Input Sources by clicking the
+ icon and finding your custom layout.
You can then have a couple options for switching between layouts. If the appropriate box at the bottom of that window is checked, you can switch with the mouse using the icon in the menu bar. Alternatively, you can set a keyboard shortcut to toggle between them by navigating to the Shortcuts tab of the same window, clicking Input Sources in the left-hand list, and double-clicking the shortcut you'd like to change.