Check Digits and the Pentagon

COA Code

. The Group of the Pentagon

Unprotect[NonCommutativeMultiply];
NonCommutativeMultiply[i_Integer,j_Integer]:= DihedralGroupTable[[i+1,j+1]] 
NonCommutativeMultiply[i_Integer]:=i
Protect[NonCommutativeMultiply];

(Subscript[D, 5]) = Range[0,9];
DihedralGroupTable={(Subscript[D, 5]),
  {1,2,3,4,0,6,7,8,9,5},
  {2,3,4,0,1,7,8,9,5,6},
  {3,4,0,1,2,8,9,5,6,7}, 
  {4,0,1,2,3,9,5,6,7,8},
  {5,9,8,7,6,0,4,3,2,1},
  {6,5,9,8,7,1,0,4,3,2},
  {7,6,5,9,8,2,1,0,4,3}, 
  {8,7,6,5,9,3,2,1,0,4},
  {9,8,7,6,5,4,3,2,1,0}};

{5**9,9**5}

Select[(Subscript[D, 5]),And@@Table[#**b==b**#,{b,(Subscript[D, 5])}] &]

DihedralInverse[n_Integer]:=Which[n==0,0,n<5,5-n,n≥5,n]
Map[DihedralInverse,(Subscript[D, 5])]

pairs=DeleteCases[Tuples[(Subscript[D, 5]),2],{x_,x_},∞]

σ[n_]:=n/.Thread[ {1,2,3,4,5,6,7,8,9}->{4,3,2,1,8,9,5,6,7}]

And@@(σ[#[[1]]]**#[[2]]≠σ[#[[2]]]**#[[1]]&)/@pairs

.  The Perfect Dihedral Method

MapIndexed[{#1,#2} &,{a,b,c,d}]

MapIndexed[((#1)^(#2[[1]] ))&,{a,b,c,d}]

DihedralCD[n_]:=Module[{digits=IntegerDigits[n]},DihedralInverse[NonCommutativeMultiply @@MapIndexed[Nest[σ,#1,Length[digits]+1-#2[[1]]]&,digits]]];
DihedralCD[1703]

VerifyDihedralCD[n_]:=DihedralCD[Quotient[n,10]]==Mod[n,10];
VerifyDihedralCD[17035]

Table[VerifyDihedralCD[17035+100 i],{i,9}]