## digitalmars.D.learn - puzzles (8-15-08)

- Wyverex (9/9) Aug 15 2008 1) Consider the number 142857. We can right-rotate this number by
- Leandro Lucarella (14/16) Aug 15 2008 Hi! No offense, but I find this constant Puzzle posts a little annoying.
- BCS (4/15) Aug 15 2008 A NG is really nice for this type of thing (not all posts are shown unti...
- Christopher Wright (8/21) Aug 15 2008 10^100 is greater than ulong.max.
- BCS (4/28) Aug 16 2008 The only practical way to do this would be an intelligent search.

1) Consider the number 142857. We can right-rotate this number by moving the last digit (7) to the front of it, giving us 714285. It can be verified that 714285=5*142857. This demonstrates an unusual property of 142857: it is a divisor of its right-rotation. Find the digits of the set of all integers n, 11 < n < 10^100, that have this property. 2 and 3 from the other day are time consuming but are good practice for new programmers!

Aug 15 2008

Wyverex, el 15 de agosto a las 11:30 me escribiste:2 and 3 from the other day are time consuming but are good practice for new programmers!Hi! No offense, but I find this constant Puzzle posts a little annoying. Is there any chance you can move it to another list where just interested people can subscribe? Thank you! -- Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/ ---------------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------------- Hello? Is there anybody in there? Just nod if you can hear me. Is there anyone at home?

Aug 15 2008

Reply to Leandro,Wyverex, el 15 de agosto a las 11:30 me escribiste:A NG is really nice for this type of thing (not all posts are shown until you open them and it's threaded) Hay Walter! Any Way to talk you into adding an OT newsgroup?2 and 3 from the other day are time consuming but are good practice for new programmers!Hi! No offense, but I find this constant Puzzle posts a little annoying. Is there any chance you can move it to another list where just interested people can subscribe? Thank you!

Aug 15 2008

Wyverex wrote:1) Consider the number 142857. We can right-rotate this number by moving the last digit (7) to the front of it, giving us 714285. It can be verified that 714285=5*142857. This demonstrates an unusual property of 142857: it is a divisor of its right-rotation. Find the digits of the set of all integers n, 11 < n < 10^100, that have this property. 2 and 3 from the other day are time consuming but are good practice for new programmers!10^100 is greater than ulong.max. I tried a version that went up to ulong.max. It logged every billion checks. That took a few minutes (for the first billion, I mean). Getting all the way to ulong.max would take overnight; to 10^100, ages, even if you had a ucent primitive. Granted, I was using ulongs on my 32-bit machine, so it wasn't optimal. But bignums are a lot slower.

Aug 15 2008

Reply to Christopher,Wyverex wrote:The only practical way to do this would be an intelligent search. get out the discrete book and start manipulating this: (D*10^n + M) % (10*M + D) && M < 10^n1) Consider the number 142857. We can right-rotate this number by moving the last digit (7) to the front of it, giving us 714285. It can be verified that 714285=5*142857. This demonstrates an unusual property of 142857: it is a divisor of its right-rotation. Find the digits of the set of all integers n, 11 < n < 10^100, that have this property. 2 and 3 from the other day are time consuming but are good practice for new programmers!10^100 is greater than ulong.max. I tried a version that went up to ulong.max. It logged every billion checks. That took a few minutes (for the first billion, I mean). Getting all the way to ulong.max would take overnight; to 10^100, ages, even if you had a ucent primitive. Granted, I was using ulongs on my 32-bit machine, so it wasn't optimal. But bignums are a lot slower.

Aug 16 2008