simple logic for this is :-
for example
11*11=121 (11 is 2 one’s so from 1 till 2 and back )
111*111 =12321 (111 is 3 one’s so count from 1 till 3 and back ) that is 1 2 3 and back 2 1
similarly for 12345678987654321 =111,111,111(9 one’s) *111,111,111