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

Home > Numbers
Terminating in seven sevens (Posted on 2009-06-26) Difficulty: 2 of 5
Determine the minimum value of a positive base ten integer N, such that each of the last seven digits of N3 is 7 but the eighth digit from the right in N3 is not 7.

See The Solution Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2

This program takes a couple of minutes to run and doesn't produce any results:

10   for N1=1 to 1000000000
20          if N@10<>7 then
30           :N=N1*10000000+7777777
40           :Cr=int(N^(1/3)+0.5)
50           :if Cr*Cr*Cr=N then print N
60   next
 

The more efficient program below produces results in a couple of seconds, as treating only cubes goes faster than looking at many numbers in search of a cube:

10   for N=999 to 999999999
20    C=N*N*N
30    if C@10000000=7777777 then
40      :if C@100000000<>77777777 then print N,C
50   next

 

It produces

9660753         901639512372747777777
19660753        7599769868183017777777
29660753        26094352023993287777777
39660753        62385385979803557777777
49660753        122472871735613827777777
59660753        212356809291424097777777
69660753        338037198647234367777777
79660753        505514039803044637777777
89660753        720787332758854907777777
109660753       1318723274070475447777777
119660753       1713385922426285717777777
129660753       2179845022582095987777777

 

before being stopped manually.

It shows N=9660753, whose cube is 901639512372747777777, as the minimum value.

A run of the below program:

10   for N=999 to 999999999
20    C=N*N*N
30    if C@10000000=7777777 then
40      :print N,C
50   next

 

shows that the caveat of the eighth digit from the right not being 7 was unnecessary, as such a cube with 8 7's at the end comes much higher:

9660753         901639512372747777777
19660753        7599769868183017777777
29660753        26094352023993287777777
39660753        62385385979803557777777
49660753        122472871735613827777777
59660753        212356809291424097777777
69660753        338037198647234367777777
79660753        505514039803044637777777
89660753        720787332758854907777777
99660753        989857077514665177777777
109660753       1318723274070475447777777
119660753       1713385922426285717777777
129660753       2179845022582095987777777

  Posted by Charlie on 2009-06-26 13:54:27
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

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