The Hodge conjecture is a fundamental problem in algebraic geometry. In 1979, Shioda proposed an arithmetic condition on verifying the Hodge conjecture for Fermat varieties. We divide the condition into simpler subproblems and implemented an algorithm to verify the Hodge conjecture for Fermat variety of degree 21. This case was only partially answered in 1979. Besides the Fermat varieties, a related topic is the Hodge conjecture for abelian varieties of Fermat type. For some specific degrees, we provide a necessary condition for a Hodge class to be a linear combination of “stadard elements”.