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.

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

Shift right by half a bit

PowerShell, 67 bytes param([uint64]$n)($n/[math]::Sqrt(2)).ToString("G17")-replace'\..*' Try it online! … However, the [math]::Sqrt() function only works on Double, so there we're stuck. So far, so standard. …
AdmBorkBork's user avatar
  • 43.5k
3 votes

Multiplicative persistence

PowerShell, 64 59 bytes for($a="$args";9-lt$a){$a;$a="$(($a|% t*y)-join'*'|iex)"}$a Try it online! Iterative method. Takes input and stores it into $a, then enters a for loop so long as the leng …
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
2 votes

Sum \$\text{Square}^2\$

PowerShell, 68 56 bytes param($n)1..$n|%{$a+=$_*$_*!($n%$_)};1..$a|?{$_*$_-eq$a} Try it online! Seems long ... -12 bytes thanks to mazzy Does exactly what it says on the tin. Takes the range fr …
AdmBorkBork's user avatar
  • 43.5k
3 votes

Calculate power series result

$n|%{$o+=[math]::pow($x,$_)};$o Try it online! Not bad for needing a .NET call for pow. -7 bytes thanks to mazzy. …
AdmBorkBork's user avatar
  • 43.5k
2 votes

count ones in range

PowerShell, 72 bytes param($x,$y)$x..$y|%{$o+=([convert]::ToString($_,2)-replace0).length};$o Try it online! Long because of the conversion to binary [convert]::ToString($_,2) and getting rid of …
AdmBorkBork's user avatar
  • 43.5k
5 votes

Detect heat waves

PowerShell, 121 bytes param($a)$b="";($a|%{if($_-ge25){$b+="$_ "}else{$b;$b=""}})+$b|?{(-split$_).count-ge5-and(-split$_|?{$_-ge30}).count-ge3} Try it online! or Verify all test cases PowerShell …
AdmBorkBork's user avatar
  • 43.5k
17 votes
14 answers
2k views

Conway's Prime Game

Specifically, Conway's PRIMEGAME. This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers: A B C D E F G H I J K L M N 17 …
AdmBorkBork's user avatar
  • 43.5k
23 votes
32 answers
2k views

Rotational Average

Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two rotat …
AdmBorkBork's user avatar
  • 43.5k
5 votes

Converting ISBN-13 to ISBN-10

PowerShell, 96 84 bytes $y=-(([char[]]($x="$args"-replace'^978|.$')|%{--$a*[int]"$_"})-join'+'|iex)%11;$x+$y Try it online! Takes input "$args", does a regex -replace to get only the pertinent p …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Are the numbers amicable?

PowerShell, 87 96 bytes param($a,$b)filter f($n){(1..($n-1)|?{!($n%$_)})-join'+'|iex}(f $a)-eq$b-and(f $b)-eq$a-and$a-$b Try it online! Takes input $a,$b. Defines a filter (here equivalent to a …
AdmBorkBork's user avatar
  • 43.5k
1 vote

Prime numbers between n and 2n

PowerShell, 57 bytes param($n)(2*$n-1)..++$n|?{'1'*$_-match'^(?!(..+)\1+$)..'} Try it online! Takes input $n, constructs a range from 2*$n-1 to ++$n (i.e., excluding the endpoints), and feeds th …
AdmBorkBork's user avatar
  • 43.5k
0 votes

What is the missing number (divisibility by 9)

PowerShell, 40 bytes param($a)0..9|?{!(($a-replace'x',$_)%9)} Try it online! or Verify all test cases Takes input like '123x' into $a. Constructs a range 0 to 9 and uses Where-Object (here abbre …
AdmBorkBork's user avatar
  • 43.5k
2 votes

Iterated phi sequence

PowerShell, 110 bytes $a=,0*101;2..100|%{$i=$_;for($z=$j=0;++$j-lt$i;$z+=$k-eq1){for($k=$j;$j%$k-or$i%$k;$k--){}};($a[$i]=$a[$z]+1)} Try it online! Mathematical approach. Actually, looking thro …
AdmBorkBork's user avatar
  • 43.5k

1
2 3 4 5 6
15 30 50 per page