(n T)
| 14 | ) |
| 15 | |
| 16 | func IsAutomorphic[T constraints.Integer](n T) bool { |
| 17 | // handling the negetive number case |
| 18 | if n < 0 { |
| 19 | return false |
| 20 | } |
| 21 | |
| 22 | n_sq := n * n |
| 23 | for n > 0 { |
| 24 | if (n % 10) != (n_sq % 10) { |
| 25 | return false |
| 26 | } |
| 27 | n /= 10 |
| 28 | n_sq /= 10 |
| 29 | } |
| 30 | |
| 31 | return true |
| 32 | } |
no outgoing calls