All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Squared average equals square (Posted on 2019-08-09) Difficulty: 3 of 5
Find n consecutive perfect squares (n > 1)whose average is n2.

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 3
For the average to be n^2, the sum of the n squares must be n^3, so that's what we seek.

For n = 47, the sum of the squares from the 22nd square (484) through the 68th square (4624) is 103823, the 47th cube, so that, when divided by 47 to get the average, that average is 47^2.

When n is 2161, the sum of the squares from the 989th (978121) through the 3149th (9916201) square is 10091699281, the 2161st cube; when divided by 2161 to get the average that average is 2161^2.

The program output:

47 22 484 68 4624 103823
2161 989 978121 3149 9916201 10091699281

After running the program, entering 47,2161 into Sloane's OEIS finds A189173, Integers m such that m^3 is the sum of squares of m consecutive integers. The list is preceded by zero and 1 and followed by 99359, 4568353, 210044879, 9657496081, 444034774847, 20415942146881, 938689303981679, 43159292041010353, 1984388744582494559, 91238722958753739361, 4194996867358089516047, 192878617175513363998801, 8868221393206256654428799, 407745305470312292739725953, 18747415830241159209372965039. The recursive formula is a(n) = 46*a(n-1) - a(n-2) where the a values are the n values of the puzzle.

The program:

DefDbl A-Z
Dim squares(4000), sumsquares(4000), cubes(4000), crlf$
Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
  For i = 1 To 4000
    squares(i) = i * i
    sumsquares(i) = sumsquares(i - 1) + squares(i)
    cubes(i) = squares(i) * i
  Next
  
  For n = 2 To 4000
    For subtr = 0 To 4000 - n
      cube = sumsquares(subtr + n) - sumsquares(subtr)
      If cube = cubes(n) Then
         Text1.Text = Text1.Text & n & Str(subtr + 1) & Str(squares(subtr + 1))
         Text1.Text = Text1.Text & Str(subtr + n) & Str(squares(subtr + n)) & Str(cubes(n)) & crlf
      End If
    Next
  Next
    
  Text1.Text = Text1.Text & crlf & " done"
  DoEvents

End Sub


  Posted by Charlie on 2019-08-09 12:59:34
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (4)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2021 by Animus Pactum Consulting. All rights reserved. Privacy Information