



snake_case_    					=	[sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)]

def 			_lowerCAmelCase				(       lowercase_						):
						UpperCAmelCase					=			0
						while number:
												# Increased Speed Slightly by checking every 5 digits together.
												sum_of_digits_squared += DIGITS_SQUARED[number % 100000]
												number //= 100000

						return sum_of_digits_squared


# There are 2 Chains made,
# One ends with 89 with the chain member 58 being the one which when declared first,
# there will be the least number of iterations for all the members to be checked.

# The other one ends with 1 and has only one element 1.

# So 58 and 1 are chosen to be declared at the starting.

# Changed dictionary to an array to quicken the solution
snake_case_    					=	[None] * 1000_0000
snake_case_    					=	True
snake_case_    					=	False

def 			_lowerCAmelCase				(       lowercase_						):

						if CHAINS[number - 1] is not None:
												return CHAINS[number - 1]  # type: ignore

						UpperCAmelCase					=			chain(next_number(_lowerCAmelCase						)						)
						UpperCAmelCase					=			number_chain

						while number < 10000000:
												UpperCAmelCase					=			number_chain
												number *= 10

						return number_chain

def 			_lowerCAmelCase				(       lowercase_ = 10000000						):
						for i in range(1		,     _lowerCAmelCase						):
												if CHAINS[i] is None:
																		chain(i + 1						)

						return CHAINS[:number].count(_lowerCAmelCase						)


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				print(f'''{solution() = }''')










"""simple docstring"""


def 			_lowerCAmelCase				(       ):
						for n in range(1		,     1000000						):
												yield n * (n + 1) // 2

def 			_lowerCAmelCase				(       lowercase_						):
						UpperCAmelCase					=			1
						UpperCAmelCase					=			2
						while i * i <= n:
												UpperCAmelCase					=			0
												while n % i == 0:
																		n //= i
																		multiplicity += 1
												divisors_count *= multiplicity + 1
												i += 1
						if n > 1:
												divisors_count *= 2
						return divisors_count

def 			_lowerCAmelCase				(       ):
						return next(i for i in triangle_number_generator() if count_divisors(lowercase_						) > 500						)


if __name__ == "__main__":
				print(solution())





