Brian J
  • Member for 7 years, 7 months
  • Last seen this week
One OEIS after another
8 votes

13. VB.NET (.NET 4.5), 1246 bytes, A000131 Public Class A000131 Public Shared Function Catalan(n As Long) As Long Dim ans As Decimal = 1 For k As Integer = 2 To n ans *...

View answer
Snowball Fight KoTH!
5 votes

The Naming-things-is-hard Bot - VB.NET Naming things is hard, and I'm not sure I have a cohesive strategy to name it off of. Tries to gamble the first few rounds to get an early victory. After that, ...

View answer
The Futuristic Gun Duel
5 votes

The PlasmaPlayer The Plasma Player like firing his plasma bolts. He will try to load and fire as much as possible. However, while the opponent has plasma ammo, he will use his thermal shield (...

View answer
Count Consecutive Characters
4 votes

TSQL (Microsoft SQL Server), 206 bytes WITH C AS (SELECT 1p,SUBSTRING(@,1,1)c UNION ALL SELECT p+1,SUBSTRING(@,p+1,1)FROM C WHERE p<LEN(@)),R AS(SELECT c d,1r FROM C UNION ALL SELECT c,r+1FROM R ...

View answer
Create a binary wall
4 votes

T-SQL, 290 bytes declare @ int;select @=max(log(a,2))+1from @i;with t as(select convert(varchar(max),a%2)b,a/2c,@-1m,ROW_NUMBER()over(order by(select 1))r from @i union all select convert(varchar(max)...

View answer
Translate Morse code based on tone duration
3 votes

Visual Basic .NET (.NET Core), 252 bytes -7 bytes thanks to @recursive Function A(i) For Each w In i.Split({"0000000"},0) For Each l In w.Split({"000"},0) Dim c=0 For Each p In l.Split("0") c=c*2+1+...

View answer
The Easter Egg Hunt on the Hill
3 votes

Java Bunny This bunny hasn't finished growing up yet (I still plan to make changes), but it's a starting point for right now. He looks for the closest egg and goes towards it. There isn't wall ...

View answer
Most Common Multiple
2 votes

SQL Server, 93 bytes SELECT TOP 1a.a*b.a FROM @ a JOIN @ b ON a.i<b.i GROUP BY a.a*b.a ORDER BY COUNT(a.a*b.a)DESC Input is assumed to come from a table of the form DECLARE @ TABLE (A int, i int ...

View answer
Modulus Summation
2 votes

T-SQL, 80 79 bytes -1 byte thanks to @MickyT WITH c AS(SELECT @ i UNION ALL SELECT i-1FROM c WHERE i>1)SELECT SUM(@%i)FROM c Receives input from an integer parameter named @, something like this:...

View answer
One OEIS after another
2 votes

105. Windows Batch, 193, A000267 @echo off :SquareRoot number set /A number=4 * %1 + 1, last=2, sqrt=number/last :nextIter set /A last=(last+sqrt)/2, sqrt=number/last if %sqrt% lss %last% goto ...

View answer
One OEIS after another
2 votes

103. VB6, 713 bytes, A000158 Function A000158(ByVal n As Long) As Long Dim x1 As Long, x2 As Long, x3 As Long A000158 = 0 n = n + 3 x1 = 1 x2 = 1 x3 = 1 While x1 ^ (2 / 3)...

View answer
When Fibonacci meets the Queens
2 votes

VB.NET, (.NET 4.5), 1238 1229 bytes -9 bytes thanks to @totallyhuman Function A(n,x) Dim g=New List(Of List(Of Long)) g.Add(New List(Of Long)) g(0).Add(1) For i=2To n Dim b=1 If i>2Then Dim w=0,...

View answer
Close-Knit Words
2 votes

T-SQL (SQL Server 2014), 217 bytes Golfed declare @ table(a char)declare @i int=1while @i<=len(@a)begin insert into @ values(SUBSTRING(@a,@i,1))set @i+=1 end select distinct t.a+u.a+v.a from @ t,@...

View answer
Implement t9-like functionality
2 votes

Java: 395 This forms a regex pattern based on the letters that are allowed for each number, and then tacks on a .* at the end to match any following characters. Here is the golfed version: static ...

View answer
Seqindignot sequence
1 votes

Visual Basic .NET (.NET 4.5), 260 259 bytes -1 byte thanks to Kevin Cruijssen Function A(n) Dim p=New System.Collections.Generic.List(Of Long),j="0",g=0 For i=0To n j=0 While 1 If Not p.Contains(j)...

View answer
Return of the Hydra Slayer
1 votes

VB.NET (.NET 4.5), 439 + 35 (imports) = 474 bytes Requires Imports System.Collections.Generic Const N=Nothing Function Z(h,r,a,Optional c=N,Optional p=N,Optional ByRef s=N) If c Is N Then c=New List(...

View answer
Implement Anyfix Notation!
1 votes

VB.NET (.NET 4.5) 615 576 bytes -39 bytes thanks to Felix Palmen by changing \r\n to \n Requires Imports System.Collections.Generic (included in byte count) Dim s=New Stack(Of Long),q=New List(Of ...

View answer
Let's converge to 9!
1 votes

VB.NET (.NET 4.5.2), 107 + 20 (imports) = 117 bytes Requires Imports System.Linq Function A(n) While n<>9 n=If(n Mod 2=0,n/2+1,CStr(n^2).Sum(Function(c)Val(c))) A+=1 End While End Function ...

View answer
Sort a difference list
1 votes

VB.NET (.NET 4.5), 109 bytes Sub A(n) Dim c=n.count-1 For i=1To c n(i)+=n(i-1) Next n.Sort() For i=c To 1 Step-1 n(i)-=n(i-1) Next End Sub A function that expects a list as input and modifies it ...

View answer
Is it a Sphenic Number?
1 votes

VB.NET (.NET 4.5), 104 bytes Function A(n) For i=2To n If n Mod i=0Then A+=1 n\=i End If If n Mod i=0Then A=4 Next A=A=3 End Function I'm using the feature of VB where the function name is also a ...

View answer
The bouncing sequence
1 votes

VB.NET (.NET 4.5), 222 bytes Function A(n) Dim s=New List(Of Long) For i=2To n Dim c=2 While Math.Abs(i-c)<2Or g(c,i)>1Or s.Contains(c) c+=1 End While s.Add(c) Next Return s.Last End Function ...

View answer
Count My Change
1 votes

T-SQL, 41 36 34 bytes select*from @ order by right(a,5) Explanation Assume the input is pre-loaded in a table variable named @, with a single column named a, where each value is one coin to be ...

View answer
Is it an Odd Word?
1 votes

T-SQL (SQL Server 2014), 217 bytes Golfed declare @ table(a char)declare @i int=1while @i<=len(@a)begin insert into @ values(SUBSTRING(@a,@i,1))set @i=@i+1 end select count(*)%2from @ where a in('...

View answer
Morra, the Noble Game of Kings
1 votes

NullifierBot, Java Always throws 0 to minimize any opponent winnings. If the opponent ever guesses my number, they only earn what they threw. Always guesses 5 to maximize my winnings. Since I can't ...

View answer
Replace all items with their counts
0 votes

T-SQL, 80 bytes SELECT c FROM (SELECT a b,COUNT(*)c FROM @ GROUP BY a)x JOIN @ ON a=b ORDER BY i Example Input Requires something like this for input DECLARE @ TABLE (a int, i int identity) INSERT ...

View answer
How happy is this emoticon?
0 votes

T-SQL, 34 bytes SELECT CHARINDEX(RIGHT(@,1),'|)D')-1 Requires the variable @ to be declared and assigned the input. This code takes the right most character, and searches an indexed list of the ...

View answer
Minimal Power Root
0 votes

Visual Basic .NET (.NET Core), 290 bytes (includes imports) Iterator Function A()As System.Collections.IEnumerable Dim i=B.One,q=i,p=i While 1=1 q=i-1 p=i While q<>p For j=0To 9 If p.ToString....

View answer
Recover the prime from the prime power
0 votes

Visual Basic .NET (.NET Framework v4.5), 123 71 bytes -52 bytes thanks to @Jo King Function A(n) For i=n To 2 Step-1 A=If(n Mod i=0,i,A) Next End Function Try it online! Ungolfed: Function A(...

View answer
Find my polyphthongs!
0 votes

T-SQL (SQL Server 2014), 281 bytes ;with s as(select substring(@,1,1)C,stuff(@,1,1,'')D,1 R union all select substring(D,1,1),stuff(D,1,1,''),R+1from s where len(D)>0),c as(select R i,C w from s ...

View answer
Differences of MaxMin Divisor Pairs (DMDP)
0 votes

VB.NET (.NET 4.5) 116 115 bytes Function A(n) For i=1To 10^4 Dim s As Byte=Math.Sqrt(i) While i Mod s>0 s-=1 End While A-=i/s-s<n Next End Function Explanation: A function that takes n as a ...

View answer