wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> cs >> Curious numbers
(Message started by: FiBsTeR on Jul 7th, 2018, 6:26am)

Title: Curious numbers
Post by FiBsTeR on Jul 7th, 2018, 6:26am
A k-curious number is a positive integer s such that when you multiply s by k, you get s except with the right-most digit moved to the left.

For example, the smallest 4-curious number is 102564 because:
102564 * 4 = 410256

The smallest 5-curious number is 142857 because:
142857 * 5 = 714285

What is the smallest 6-curious number?

Title: Re: Curious numbers
Post by towr on Jul 7th, 2018, 12:23pm
[hide]It seems to be 1016949152542372881355932203389830508474576271186440677966

Say we're trying to find the number N = 10M+D where D is a digit and M a natural number
We want 6*(10M+D) = D*10^K + M, where K is the number of digits in M
Simplify this to 59*M = (10^K-6)*D
And now you can do a much more targeted search than running through every number: D is limited to 9 choices, and we can just try increasing K

#python-code
for K in range(100):
for D in range(1,10):
 X = (10**K-6)*D
 if X % 59 == 0:
  M = X//59
  if len(str(10*M+D)) == len(str(D*10**K + M)):
   print((10*M+D), '-', D*10**K + M)
[/hide]

Title: Re: Curious numbers
Post by towr on Jul 7th, 2018, 12:32pm
Wikipedia calls these [hide]parasitic numbers[/hide]

Title: Re: Curious numbers
Post by FiBsTeR on Jul 9th, 2018, 7:34am
Nice, that's right!



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board