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

Home > Just Math
Minimum Integer (Posted on 2014-02-28) Difficulty: 3 of 5
Determine the smallest positive integer whose first 6 multiples (including itself) contain the digit 2.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Brute force solution | Comment 1 of 4
As a hobby I've decided I'm going to try to learn some programming (I've picked up bits and pieces through the years but it's not something I've ever really studied).  I'm starting with Python.  Here's a program I wrote to find the solution to this problem:

num = 2
ans = 0
while ans == 0:
ans = num
for m in range(1,7):
mult = num * m
if '2' not in list(str(mult)):
ans = 0
break
num += 1
print ans, ans*2, ans*3, ans*4, ans*5, ans*6

I imagine this is not the most elegant solution, and I welcome comments from Charlie or anyone else who knows anything about programming.  But it ran quickly and produced the answer 642.



  Posted by tomarken on 2014-02-28 11:58:05
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 (0)
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