Talk:Permuted multiples

From Rosetta Code

Can we reuse Project Euler problems?

It appears under their Copyright terms we can do so as long as suitable attribution is given. However, if I am wrong about this, then the draft task should of course be deleted. --PureFox (talk) 09:03, 17 August 2021 (UTC)

Just because a problem/puzzle appears on   Project Euler   doesn't mean they own it.   I've seen some of their problems that have been around on newsgroups   (alt.math.recreational, alt.puzzles, etc)   of days long gone by.     -- Gerard Schildberger (talk) 10:12, 17 August 2021 (UTC)
I'm sure you're right and some problems may go back as far as Diophantus though Project Euler may be the first organization to apply copyright to them. I can't see any reason not to reuse the occasional problem myself as long as we don't make a habit of it - I don't think the admins would be too happy if Calmosoft decided to run through the whole lot! --PureFox (talk) 10:30, 17 August 2021 (UTC)
There is some historical precedent. First power of 2 that has leading decimal digits of 12 is a Project Euler problem. There may be some others but none come to mind immediately. The point of Project Euler though, is to work out how to do the problems yourself, not to provide finished examples for other people to see. As such, I would prefer to not have too many Project Euler problems duplicated here. Not that I could prevent it if the community goes that way. I have pretty much stopped trying to moderate task submissions except for the most blatant plagiarisms / infringing works. (I do wish Calmosoft would spend more of his effort in solving some of the unimplemented Ring tasks rather than persisting in adding trivial variations of existing tasks or plagiarized content. And, it is somewhat telling that as soon as trivial or plagiarized comes up, his name comes to mind.) --Thundergnat (talk) 12:00, 17 August 2021 (UTC)
If these three sites do not attract disapprobation I don't think our use will: Project Euler solutions Java Mathmatica Python Haskell; Project Euler solutions C#; Project Euler solutions C++. The Haskell wiki has hundreds of examples from Project Euler. These sites do at least look at the mathematics, and produce efficient solutions, which is the intent of Project Euler while the content on this site is often flaky but...--Nigel Galloway (talk) 14:09, 17 August 2021 (UTC)

There are common tasks on Rosetta Code and Project Euler.
For example:
Lychrel numbers on Rosetta Code
Lycher numbers on Project Euler (Problem #55)--CalmoSoft (talk) 12:05, 17 August 2021 (UTC)

Exploring the same concept is not duplication / plagiarism. Using the exact same wording to solve the exact same problem is. --Thundergnat (talk) 12:29, 17 August 2021 (UTC)
You are right.--CalmoSoft (talk) 12:34, 17 August 2021 (UTC)

Ranges to be checked

I've added a comment to Project Euler solutions C# 52 which is awaiting moderation: "The ranges to be checked can be reduced to 10^n->(10^(n+1))/6 i.e 10000->16666 because 16667*6 contains an extra digit.". So fingers crossed I've got that right.--Nigel Galloway (talk) 15:01, 17 August 2021 (UTC)

At the above zhilongji notes "since x and 3x have the same digits,x%3 == 0 will always be true, so we can search with the start as 10^i+2,and the step as 3." which is correct--Nigel Galloway (talk) 15:24, 17 August 2021 (UTC)

Extending this for bases other than 10 then for an n digit number the range is (basen-1+step-1)base..stepbase..(base(n)/max multiplier)base, step is the lcm of the multipliers which meet the condition (base-1)%multiplier=0. So for 10 digit numbers with multipliers 1..7 and in base 13: 100000000B13..C13..1B1B1B1B1B13. Note that the digital root of the candidates is step--Nigel Galloway (talk) 11:40, 20 August 2021 (UTC)

Incorrect extended output for Pascal

As shown in the Phix entry, once you know the result for 6 digits longer examples can be found by multiplying all of the one-digit-less by 10 and replacing the final trailing 0 with a 9 in the middle, so for k (>=6) digits there are (at least) k-5 possible values for n:

6 digits:  142857
7 digits:  1428570
           1429857
8 digits:  14285700
           14298570
           14299857
9 digits:  142857000
           142985700
           142998570
           142999857
10 digits: 1428570000
           1429857000
           1429985700
           1429998570
           1429999857

The Pascal entry would of course be correct under a "no repeated digits" rule. --Pete Lomax (talk) 09:04, 18 August 2021 (UTC)

Yes, that was my faulty approach.I used the array of digits and permute them after the leading "1".
But now we can see, that only an extention by multible "0" or insertion of "Base-1" within the biggest number found, leads to more digits.
Base 10
With 6 digits
 1x  :142857
 2x  :285714
 3x  :428571
 4x  :571428
 5x  :714285
 6x  :857142
rekCount 10725
With 7 digits //142857 extended by "0"
 1x  :1428570
 2x  :2857140
 3x  :4285710
 4x  :5714280
 5x  :7142850
 6x  :8571420
rekCount 50244
With 7 digits //142857 extended by "9"
 1x  :1429857
 2x  :2859714
 3x  :4289571
 4x  :5719428
 5x  :7149285
 6x  :8579142
rekCount 50469
With 8 digits //142857extended by "0" and "9"
 1x  :14298570
 2x  :28597140
 3x  :42895710
 4x  :57194280
 5x  :71492850
 6x  :85791420
rekCount 192563

Base 13
With 10 digits
 1x  :12495BA837
 2x  :2495BA8371
 3x  :3712495BA8
 4x  :495BA83712
 5x  :5BA8371249
 6x  :712495BA83
 7x  :83712495BA
rekCount 41174743
With 11 digits
 1x  :12495BA8370 //12495BA837 extended by "0"
 2x  :2495BA83710
 3x  :3712495BA80
 4x  :495BA837120
 5x  :5BA83712490
 6x  :712495BA830
 7x  :83712495BA0
rekCount 170444721
With 11 digits   //12495BA837 extended by "C" aka Base-1
 1x  :12495CBA837
 2x  :2495BCA8371
 3x  :37124C95BA8
 4x  :495BAC83712
 5x  :5BA83C71249
 6x  :71249C5BA83
 7x  :83712C495BA
rekCount 170449012

But for Base = 14, maybe i shall test further til 11x

With 14 digits
 1x  :18075D6C4B3A29
 2x  :3210BCDA987654
 3x  :4A183C6905B27D
 4x  :64219BD7530CA8
 5x  :7C291B65A048D3
 6x  :96327AD40B851C
 7x  :B039DA6258C147
 8x  :C84359D0A61B72
rekCount 26733588778
With 14 digits
          v=v  are swapped
 1x  :18076D5C4B3A29
 2x  :3210DCBA987654
 3x  :4A186C3905B27D
 4x  :6421DB97530CA8
 5x  :7C296B15A048D3
 6x  :9632DA740B851C
 7x  :B03A69D258C147
 8x  :C843D950A61B72
rekCount 26734671088

-Horst.h (talk) 10:06, 18 August 2021 (UTC)

That is curious. You may be interested to know there are in fact zillions of base 2 solutions, the first 11 with decimal equivalents in the right hand column are shown below, and it appears that k-5 aspect is at least initially holding:
{{`000111`, 7},
 {`001110`, 14},
 {`010101`, 21},
 {`011100`, 28},
 {`100011`, 35},
 {`101010`, 42}}
{{`0001110`, 14},
 {`0011100`, 28},
 {`0101010`, 42},
 {`0111000`, 56},
 {`1000110`, 70},
 {`1010100`, 84}}
{{`0001111`, 15},
 {`0011110`, 30},
 {`0101101`, 45},
 {`0111100`, 60},
 {`1001011`, 75},
 {`1011010`, 90}}
{{`00011100`, 28},
 {`00111000`, 56},
 {`01010100`, 84},
 {`01110000`, 112},
 {`10001100`, 140},
 {`10101000`, 168}}
{{`00011110`, 30},
 {`00111100`, 60},
 {`01011010`, 90},
 {`01111000`, 120},
 {`10010110`, 150},
 {`10110100`, 180}}
{{`00011111`, 31},
 {`00111110`, 62},
 {`01011101`, 93},
 {`01111100`, 124},
 {`10011011`, 155},
 {`10111010`, 186}}
{{`000101101`, 45},
 {`001011010`, 90},
 {`010000111`, 135},
 {`010110100`, 180},
 {`011100001`, 225},
 {`100001110`, 270}}
{{`000111000`, 56},
 {`001110000`, 112},
 {`010101000`, 168},
 {`011100000`, 224},
 {`100011000`, 280},
 {`101010000`, 336}}
{{`000111100`, 60},
 {`001111000`, 120},
 {`010110100`, 180},
 {`011110000`, 240},
 {`100101100`, 300},
 {`101101000`, 360}}
{{`000111110`, 62},
 {`001111100`, 124},
 {`010111010`, 186},
 {`011111000`, 248},
 {`100110110`, 310},
 {`101110100`, 372}}
{{`000111111`, 63},
 {`001111110`, 126},
 {`010111101`, 189},
 {`011111100`, 252},
 {`100111011`, 315},
 {`101111010`, 378}}
Our collective "1st digit must be 1" assumption is starting to look decidedly wrong. --Pete Lomax (talk) 17:03, 18 August 2021 (UTC)
"Our collective "1st digit must be 1" assumption is starting to look decidedly wrong."
But I don't think so.How will you determine the count of digits with trillions of "0" in front ;-)
But it would be nice, not to fix to "1", if the base is 13 then "2" at start can succeed in 1x..6x -Horst.h (talk) 17:56, 18 August 2021 (UTC)

Step counts in Phix

Hi Pete. I don't know if it's deliberate, but your step counts don't include the steps which actually find the numbers. --Nig (talk) 10:57, 18 August 2021 (UTC)

Semi-deliberate - for me the first place I look is zero steps away. However the "bump" is arguably a step. So I'm left with two choices: either increment steps before the i=7 check, or reset steps to 1 on bump. Since I can't quite decide, and it's not really important, I'll do neither. --Pete Lomax (talk) 13:08, 18 August 2021 (UTC)