I have been having fun solving some Project Euler problems. Most of my 76 solutions were done in XSLT 2.0 last year.
For those who are busy arguing whether or not XSLT is a programming language, here is one easy problem:
The 5-digit number, 16807=7^{5}, is also a fifth power. Similarly, the 9-digit number, 134217728=8^{9}, is a ninth power.
How many n-digit positive integers exist which are also an nth power?
Below is the solution, and it takes 20ms to run with Saxon 9.1.07:
<xsl:stylesheet version="2.0" xmlns:xsl=http://www.w3.org/1999/XSL/Transform xmlns:f=http://fxsl.sf.net/> <xsl:import href="../../../f/func-exp.xsl"/> <xsl:output method="text"/> <xsl:template match="/"> |
f:intppow(k, n) is an FXSL 2.x function with positive integer arguments that calculates k^{n.}
^{And if all this is possible even now, imagine yourself working with XSLT 2.1 in the near future… }