Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 42963

The challenge involves mathematics in some central way. Also consider using more specific tags, listed in the tag wiki info.

4 votes

Product over a range

PowerShell, 30 Bytes param($a,$b)$a..$b-join'*'|iex Takes input as two integers, creates a range with .., then -joins that with asterisks, pipes it into Invoke-Expression (similar to eval). The ran …
AdmBorkBork's user avatar
  • 43.5k
3 votes

Return the integers with square digit-sums

([math]::Sqrt(([char[]]"$_"-join'+'|iex))%1)} Try it online! … Our selection is based on the .NET call [math]::Sqrt() of the digit-sum of the number is an integer with !(...%1). …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Calculate the difficulty of a Code Golf question

PowerShell v2+, 47 bytes -join(('*'*11)[1..($args[0]/$args[1]/70+.499)]) Somewhat a port of @Neil's JavaScript answer. Takes input $args and divides them, then divides that by 70, and adds .499. S …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Lonely Multiplication

PowerShell, 97 bytes param($n)$a,$b,$c=$n|group;(($n-join'*'|iex),(($a,$b|?{$_.count-eq1}).name,1)[$a.count-eq3])[!$c] Try it online! Not terribly impressive, but given that PowerShell doesn't h …
AdmBorkBork's user avatar
  • 43.5k
2 votes

Product over exclusive and inclusive ranges

PowerShell, 146 104 Bytes param($i)$a,$b=$i.trim("[]()")-split',';($a,(1+$a))[$i[0]-eq'(']..($b,(+$b-1))[$i[-1]-eq')']-join'*'|iex Golfed off 42 bytes by changing how the numbers are extracted from …
AdmBorkBork's user avatar
  • 43.5k
0 votes

Smallest Diversifying Exponent

PowerShell, 107 bytes param([bigint]$a)for([bigint]$b=1;-join("$([bigint]::pow($a,$b))"|% t*y|sort -u)-ne-join(0..9);$b=$b+1){}$b Try it online! Pretty straightforward, just a shame we need to u …
AdmBorkBork's user avatar
  • 43.5k
0 votes

Average of a string

PowerShell, 60 Bytes param([char[]]$a)$a|%{$b+=[int]$_};[char][int]($b/$a.Length) Nothing esoteric. Takes input string param(..) and casts it as a char[]. Iterates over that array $a|%{..}, and each …
AdmBorkBork's user avatar
  • 43.5k
0 votes

Sort a concatenated sequence

PowerShell, 167 166 bytes param($x,$w)if($w-lt($x-eq0)){"0`n"*15;exit}[char[]]("$x"+-join(0..13|%{$w;$w=$x+($x=$w)}))|%{$z+="$_";if(+$z-gt$y){($y=$z);$z=""}};if($z){while(+$z-lt$y){$z+="0"}$z} Saved …
AdmBorkBork's user avatar
  • 43.5k
3 votes

Summation from a to b

PowerShell, 32 31 29 Bytes $args-join'..'|iex|measure -s Thanks to TessellatingHeckler for the alternate way to make a range and sum it. Works for any combination of a and b so long as the difference …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Write a program that makes 2 + 2 = 5

PowerShell $c=2 # Set variable = 2 Write-Host ("$c + $c = " + $(2+($c++,$c--)[$c-eq2])) # Perform the addition and output Write-Host ("c = $c") …
AdmBorkBork's user avatar
  • 43.5k
3 votes

Print the difference in the Thue-Morse sequence

PowerShell, 102 bytes filter x($a){2*$a+([convert]::toString($a,2)-replace0).Length%2} 0..($args[0]-1)|%{(x($_+1))-(x $_)-1} A little bit of a different way of computing. PowerShell doesn't have an e …
AdmBorkBork's user avatar
  • 43.5k
2 votes

Find the number in the Champernowne constant

PowerShell, 54 50 Bytes for($c='';!($x=$c.IndexOf("$args")+1)){$c+=++$i}$x Thanks to TessellatingHeckler for the idea of swapping the while loop for a for loop. Executes via a for loop. As with ot …
AdmBorkBork's user avatar
  • 43.5k
0 votes

Zeroes at the end of a factorial

PowerShell v2+, 60 bytes (but see the NB below) A completely different approach, doing exactly what is requested by the challenge. ;-) $a=2..$args[0]-join'*'|iex;"$a".length-"$a".Trim('0').length …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Divisor reduction

PowerShell v2+, 74 67 bytes param($n)for($o=0;$n-gt0){$a=0;1..$n|%{$a+=!($n%$_)};$n-=$a;$o++}$o Seems pretty lengthy in comparison to some of the other answers... Takes input $n, enters a for loop …
AdmBorkBork's user avatar
  • 43.5k
8 votes

The Solitude of Prime Numbers

PowerShell v2+, 237 149 147 231 216 181 174 169 166 bytes param($n)filter f($a){'1'*$a-match'^(?!(..+)\1+$)..'}for($i=$n;!((f $i)-and(f($i+2)))){$i++}for(){if(f(--$i)){if((f($i-2))-or(f($i+2))){if($i …
AdmBorkBork's user avatar
  • 43.5k

1
2 3 4 5 6
15 30 50 per page