The code is submitted for the Number of Palindromic Numbers Delphi Challenge
function DavidReed_NumberOfPalindromes(const maxNumber : int64) : int64;
var
x,y,z: integer;
s: string;
begin
s := IntToStr(MaxNumber) ;
x := Length(s) div 2;
z := 1;
if Odd(Length(s)) then begin
Inc(x) ;
z := 0;
end;
Result := StrToInt(Copy(s,1,x)) + Trunc(Power(10,Length(s) - x)) ;
for y := 1 to x do begin
if s[x - y + z] = s[x + y] then
Continue;
if s[x - y + z] > s[x + y] then
Dec(Result) ;
Break;
end;
end;
Test data: MAXNUMBER = 10 000 000
David's speed result: 3630 nanoseconds.
Explore the list of all accepted entries for the Number of Palindromic Numbers Delphi Challenge.

