Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer (edit - I gave up after 90 minutes). Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer (edit - I gave up after 90 minutes). Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer (edit - I gave up after 90 minutes). Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

Gave up after 90 minutes
Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer (edit - I gave up after 90 minutes). Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer. Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer (edit - I gave up after 90 minutes). Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

PowerShell v2+, 90 bytes

for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)1円+$)..'){$a+=$i}}$b-2

Combines the logic of my Find the number in the Champernowne constant answer, coupled with the prime generation method of my Print the nth prime that contains n answer, then subtracts 2 to output the index appropriately (i.e., not counting the 0. at the start).

Takes input as a string. Finds the 999 one in about seven seconds on my machine, but the 33308 one in quite a bit longer. Should theoretically work for any value up to index [Int32]::Maxvalue aka 2147483647, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.

AltStyle によって変換されたページ (->オリジナル) /