Talk:First power of 2 that has leading decimal digits of 12
Appearance
License check
We seem to be following the license from the original site, (although I couldn't find the problem number to add a link).
- Note: I am not the uthor of thie task, just checking the license. --Paddy3118 (talk) 22:51, 15 January 2020 (UTC)
- I've found the problem number which is 686. --PureFox (talk) 23:21, 15 January 2020 (UTC)
- I was just about to add the (home page) information. I had originally phrased the problem much differently, but then it seemed to be more confusing and somewhat unclear, so I went with the original wording and phrasing that someone had paraphrased. I tried to find the problem on that website, but I couldn't find (I must have mis-remembered some keyword/keywords because I couldn't locate it via my search engine, other than it was on that site. -- Gerard Schildberger (talk) 23:29, 15 January 2020 (UTC)
significance of a given p value
- The reasoning behind that (I believe) was to give the programmer an answer so that it could be used for verification of their programming solution to check if their calculation was working correctly for a "modest" (or easy) expression/formula. -- Gerard Schildberger (talk) 00:07, 16 January 2020 (UTC)
is there an easy way to get those delta 2^i (delta = i-Last_i ) ?
searching for '123' there is a double 485
Delta
90 289 196 289 196 485 196 289 196 289 196 289 196 485 196 289 196 289 196 289 196 485 196 289 196 289 196 289 196 485 485 196
searching for '317' ( not the smallest at start, 1651 seldom )
779 485 485 1651 485 485 1166 485 485 1166 485 485 1166 485 485 1166 485 485 1166 485 485 1166 485 485 1651
--Horst.h12:14, 20 January 2020 (UTC)~
- In my first (abortive) attempt at this I'd noticed that (for a prefix of "123"), after an initial {90, 289} pair, subsequent differences were either 196, 289 or 485 (= 289 + 196). Moreover, 289 was always followed by 196 but 196 could be followed by either 289 or 485, and 485 could be followed by either 196 or 485 again. I wasn't able to discern any deeper pattern than this. So I'd ended up with this (Go) code:
- <lang go>func p123(n int) uint {
power, shift := uint(0), uint(90) one := big.NewInt(1) temp := new(big.Int) for count := 0; count < n; count++ { power += shift switch shift { case 90: shift = 289 case 289: shift = 196 case 196: shift = 289 temp.Set(one) temp.Lsh(temp, power+289) if !strings.HasPrefix(temp.String(), "123") { shift = 485 } case 485: shift = 196 temp.Set(one) temp.Lsh(temp, power+196) if !strings.HasPrefix(temp.String(), "123") { shift = 485 } } } return power
}</lang>
- But, it turned out that this was very slow (4.5 minutes) as opposed to your log based approach at around 40 seconds or so. In his Perl 6 solution, I notice that Thundergnat has managed to combine your log approach with searching for patterns in the differences:
- <lang perl 6>my @startswith123 = lazy gather loop {
state $pre = '1.23'; state $count = 0; state $this = 0; given $this { when 196 { $this = 289; my \n = $count + $this; $this = 485 unless ( 10 ** (n * $ln2ln10 % 1) ).substr(0,4) eq $pre; } when 485 { $this = 196; my \n = $count + $this; $this = 485 unless ( 10 ** (n * $ln2ln10 % 1) ).substr(0,4) eq $pre; } when 289 { $this = 196 } when 90 { $this = 289 } when 0 { $this = 90 } } take $count += $this;
}</lang>
- though, given the substantial speed-up you've already achieved with your 'alternative' version, I don't know whether considering patterns as well is going to give a worthwhile improvement. --PureFox (talk) 14:47, 20 January 2020 (UTC)
- I counted the count of occurrences of deltas.There maximal 3 and one with 1 for the first occurrence.There many long existing deltas like 485/2136 and there are not so much different deltas.
The 9,999th occurrence of 2 raised to a power whose product starts with "1" is 33,216 3 6780| 4 3219| // delta=3 6780 times and delta = 4 3219x The 9,999th occurrence of 2 raised to a power whose product starts with "2" is 56,770 1 1| 3 4496| 7 3913| 10 1589| The 9,999th occurrence of 2 raised to a power whose product starts with "3" is 80,047 3 2241| 5 1| 7 1417| 10 6340| The 9,999th occurrence of 2 raised to a power whose product starts with "4" is 103,168 2 1| 10 8936| 13 1062| The 9,999th occurrence of 2 raised to a power whose product starts with "5" is 126,269 9 1| 10 8698| 23 362| 33 938| The 9,999th occurrence of 2 raised to a power whose product starts with "6" is 149,330 6 1| 10 8460| 33 141| 43 1397| The 9,999th occurrence of 2 raised to a power whose product starts with "7" is 172,484 10 8222| 43 391| 46 1| 53 1385| The 9,999th occurrence of 2 raised to a power whose product starts with "8" is 195,442 3 1| 10 7985| 53 1123| 63 890| The 9,999th occurrence of 2 raised to a power whose product starts with "9" is 218,543 10 7748| 53 75| 63 2176| The 9,999th occurrence of 2 raised to a power whose product starts with "10" is 241,491 10 7512| 63 1518| 73 969| The 9,999th occurrence of 2 raised to a power whose product starts with "11" is 264,625 10 7273| 50 1| 63 708| 73 2017| The 9,999th occurrence of 2 raised to a power whose product starts with "12" is 287,583 7 1| 10 7036| 73 2863| 83 99| The 9,999th occurrence of 2 raised to a power whose product starts with "13" is 310,614 10 6799| 17 1| 73 2291| 83 908| The 9,999th occurrence of 2 raised to a power whose product starts with "14" is 333,738 10 6561| 47 1| 73 1719| 83 1718| The 9,999th occurrence of 2 raised to a power whose product starts with "15" is 356,799 10 6324| 73 1146| 77 1| 83 2528| The 9,999th occurrence of 2 raised to a power whose product starts with "16" is 379,717 4 1| 10 6087| 73 577| 83 3334| The 9,999th occurrence of 2 raised to a power whose product starts with "17" is 402,758 10 5850| 34 1| 73 6| 83 4142| The 9,999th occurrence of 2 raised to a power whose product starts with "18" is 425,882 10 5612| 54 1| 83 3819| 93 567| The 9,999th occurrence of 2 raised to a power whose product starts with "19" is 448,923 10 5375| 83 3485| 84 1| 93 1138| The 9,999th occurrence of 2 raised to a power whose product starts with "20" is 471,758 1 1| 10 5139| 83 3152| 93 1707| ... 83 vanishes 103 arises The 9,999th occurrence of 2 raised to a power whose product starts with "29" is 679,193 10 3003| 68 1| 83 144| 93 6851| The 9,999th occurrence of 2 raised to a power whose product starts with "30" is 702,214 10 2766| 78 1| 93 7042| 103 190| ... 10 vanishes 196 arises The 9,999th occurrence of 2 raised to a power whose product starts with "41" is 955,269 10 159| 22 1| 93 5976| 103 3863| The 9,999th occurrence of 2 raised to a power whose product starts with "42" is 978,383 32 1| 93 5879| 103 4040| 196 79| ... 103 vanishes 289 arises The 9,999th occurrence of 2 raised to a power whose product starts with "70" is 1,622,964 46 1| 93 3165| 103 115| 196 6718| The 9,999th occurrence of 2 raised to a power whose product starts with "71" is 1,646,274 93 3067| 149 1| 196 6905| 289 26| ... 93 vanishes 485 arises The 9,999th occurrence of 2 raised to a power whose product starts with "102" is 2,360,602 10 1| 93 59| 196 5562| 289 4377| The 9,999th occurrence of 2 raised to a power whose product starts with "103" is 2,381,673 113 1| 196 5522| 289 4447| 485 29| ... 289 vanishes 681 arises The 9,999th occurrence of 2 raised to a power whose product starts with "185" is 4,269,695 196 1975| 260 1| 289 45| 485 7978| The 9,999th occurrence of 2 raised to a power whose product starts with "186" is 4,293,872 196 1930| 456 1| 485 8057| 681 11| The 9,999th occurrence of 2 raised to a power whose product starts with "187" is 4,316,594 ... 196 vanishes 1166 arises The 9,999th occurrence of 2 raised to a power whose product starts with "230" is 5,306,685 61 1| 196 26| 485 7599| 681 2373| The 9,999th occurrence of 2 raised to a power whose product starts with "231" is 5,329,696 257 1| 485 7589| 681 2392| 1166 17| ... 681 vanishes 1651 arises The 9,999th occurrence of 2 raised to a power whose product starts with "303" is 6,987,488 274 1| 485 6839| 681 27| 1166 3132| The 9,999th occurrence of 2 raised to a power whose product starts with "304" is 7,010,014 470 1| 485 6829| 1166 3164| 1651 5| ... 1166 vanishes 2136 arises The 9,999th occurrence of 2 raised to a power whose product starts with "444" is 10,236,012 485 5371| 1166 20| 1600 1| 1651 4607| The 9,999th occurrence of 2 raised to a power whose product starts with "445" is 10,257,372 485 5361| 630 1| 1651 4635| 2136 2| ... 1651 vanishes 2621 arises The 9,999th occurrence of 2 raised to a power whose product starts with "830" is 19,117,769 116 1| 485 1355| 1651 2| 2136 8641| The 9,999th occurrence of 2 raised to a power whose product starts with "831" is 19,143,401 485 1344| 1767 1| 2136 8644| 2621 10| ... 485 vanishes 4757 arises The 9,999th occurrence of 2 raised to a power whose product starts with "959" is 22,091,629 485 11| 1342 1| 2136 8435| 2621 1552| The 9,999th occurrence of 2 raised to a power whose product starts with "960" is 22,115,610 857 1| 2136 8433| 2621 1565| The 9,999th occurrence of 2 raised to a power whose product starts with "961" is 22,130,562 372 1| 2136 8432| 2621 1559| 4757 7| ##### 4 Digits ... 2621 vanishes 6893 arises The 9,999th occurrence of 2 raised to a power whose product starts with "1,138" is 26,210,262 1608 1| 2136 8144| 2621 3| 4757 1851| The 9,999th occurrence of 2 raised to a power whose product starts with "1,139" is 26,234,243 1123 1| 2136 8142| 4757 1850| 6893 6| ... 4757 vanishes 9029 arises The 9,999th occurrence of 2 raised to a power whose product starts with "1,397" is 32,170,665 2136 7723| 3442 1| 4757 5| 6893 2270| The 9,999th occurrence of 2 raised to a power whose product starts with "1,398" is 32,192,510 821 1| 2136 7721| 6893 2275| 9029 2| ... 6893 vanishes 11165 arises The 9,999th occurrence of 2 raised to a power whose product starts with "1,809" is 41,649,940 250 1| 2136 7052| 6893 6| 9029 2940| The 9,999th occurrence of 2 raised to a power whose product starts with "1,810" is 41,685,086 2136 7050| 6658 1| 9029 2947|11165 1| ... 9029 vanishes 13301 arises The 9,999th occurrence of 2 raised to a power whose product starts with "2,566" is 59,093,850 2136 5818| 3310 1| 9029 3|11165 4177| The 9,999th occurrence of 2 raised to a power whose product starts with "2,567" is 59,113,559 2136 5817| 7582 1|11165 4181| The 9,999th occurrence of 2 raised to a power whose product starts with "2,568" is 59,122,103 689 1| 2136 5816|11165 4179|13301 3| ... 11165 vanishes 15437 arises The 9,999th occurrence of 2 raised to a power whose product starts with "4,412" is 101,586,005 723 1| 2136 2812|11165 1|13301 7185| The 9,999th occurrence of 2 raised to a power whose product starts with "4,413" is 101,603,578 2136 2811| 2859 1|13301 7186|15437 1| ... 2136 vanishes 12354 arises The 9,999th occurrence of 2 raised to a power whose product starts with "6,138" is 141,314,661 2136 2| 3969 1|13301 6087|15437 3909| The 9,999th occurrence of 2 raised to a power whose product starts with "6,139" is 141,343,399 6105 1|13301 6087|15437 3911| The 9,999th occurrence of 2 raised to a power whose product starts with "6,140" is 141,374,273 8241 1|12354 2|13301 6086|15437 3910| .... The 9,999th occurrence of 2 raised to a power whose product starts with "9,999" is 230,241,843 12354 6288|13301 3628|15437 83|
--User:Horst.h19:22, 20 January 2020 (UTC)~
- Taking the sequence Log10 2..Log10 2..infinity, then the task is to find values of this sequence whose decimal part is greater than or equal to the decimal part of Log10 1.2 and less than the decimal part of Log10 1.3. This can of course be calculated without considering every value of Log10 2..Log10 2..infinity.--Nigel Galloway (talk) 15:11, 15 March 2021 (UTC)
Why does the title limit the task to starting 12?
Many of the solutions solve the general case of starting say 99 etc. There is a particular significance to 12 but the task description does not emphasize this.--Nigel Galloway (talk) 14:59, 15 March 2021 (UTC)
- What would you suggest to emphasize that particular significance? -- Gerard Schildberger (talk) 17:18, 15 March 2021 (UTC)