Perfect Square and Perfect Cube

1 is the smallest positive integer that is both a perfect square and a perfect cube, write a program to find the sum of first n positive integers that are both Perfect Square AND Perfect Cube .

Find the sum of first 100 numbers, the sum is too long but don't worry, I just want the answer as mod of the actual number with 2015.

Note:

  • 1, 64, 729 . . . is the sequence of such numbers.

  • answer = sum mod 2015


this problem is a part of the set Fundamental Programming
2014 1234 1455 1995

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

展豪 張
Mar 6, 2016

A straight forward python one-liner:
sum(i**6 for i in range(1,101))%2015

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...