5 kyu

Palindrome integer composition

128 of 329KenKamau

Description:

The palindromic number 595 is interesting because it can be written as the sum of consecutive squares: 6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2 = 595.

There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums. Note that 1 = 0^2 + 1^2 has not been included as this problem is concerned with the squares of positive integers.

Given an input n, find the count of all the numbers less than n that are both palindromic and can be written as the sum of consecutive squares.

For instance: values(1000) = 11. See test examples for more cases.

Good luck!

This Kata is borrowed from Project Euler #125

If you like this Kata, please try:

Fixed length palindromes

Divisor harmony

Performance
Algorithms

Stats:

CreatedAug 21, 2017
PublishedAug 21, 2017
Warriors Trained1728
Total Skips123
Total Code Submissions3448
Total Times Completed329
Python Completions128
JavaScript Completions59
Ruby Completions15
C++ Completions52
C# Completions27
Java Completions55
Go Completions19
Total Stars47
% of votes with a positive feedback rating87% of 90
Total "Very Satisfied" Votes69
Total "Somewhat Satisfied" Votes18
Total "Not Satisfied" Votes3
Total Rank Assessments4
Average Assessed Rank
5 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • KenKamau Avatar
  • raulbc777 Avatar
  • hobovsky Avatar
Ad