Mystical Ninja is my favorite series and I really like the SNES entries. Before you start I recommend playing Goemon's Great Adventure 2 on N64, it's an update of the same formula as the first SNES game.
If you are going the educational route with this formula you have to fit some history in there. One of my favorite things about the Mystical Ninja series was how it incorporated so much historic Japanese folklore and culture as well as geography. As for the math part, I think the most natural way to incorporate it would be to have loot from the dungeon that can only be turned into currency via math based mini-games, maybe at crafting stations that scale in both difficulty and payout as the game progresses. A good use for the in game currency would be to build up the town and unlock new buildings.
I don't know if you should base the game in Japan seeing as how it's already been done a million times by the Japanese. One of my other favorite SNES games is Pocky & Rocky which is the same aesthetic but in a SHUMP. There are countless other games that use historic Japan as a setting. If you are dead set on Japan as the setting it could still work, I personally would like to see this same formula applied to other locales. Since it is a math game set it in a place that had a concept of the number 0 like the Mayans, Arabs and Indians, or set it in Italy around the time they switch from Roman to Arabic numerals. Come to think of it Italy during the renaissance would be a cool setting. Pick one or two historical figures to base your main characters off of, work da Vinci and engineering in there and travel around the peninsula collecting things and visiting other areas.