g | x | w | all
Bytes Lang Time Link
801408. Whitespace250620T152302Zfluffyyb
346239. Boo171027T190541ZMaya
350386. Zig220818T033923Zalephalp
373407. Dart240209T182459Zenzo
198406. Symja221009T065700Zalephalp
202366. HOPS211206T102351Zalephalp
175405. Cognate220910T172809Zchunes
309404. Raku220910T171359ZnaffetS
234403. Quipu220910T054255Zalephalp
254402. Crystal220905T030647ZnaffetS
303401. HOPS220905T023338Zalephalp
314400. Prolog SWI220904T173705ZAiden Ch
798384. Clean220624T041116Zalephalp
279399. PARI/GP220904T062521Zalephalp
176398. GeoGebra220904T024425ZAiden Ch
498397. Go220904T005433ZnaffetS
185396. Desmos220901T053401ZAiden Ch
424395. Knight220901T035332ZnaffetS
248394. kalker220830T032906Zalephalp
374391. Egison220829T033842Zalephalp
181393. Red220829T051851Zchunes
212392. Ruby220829T042823ZnaffetS
191390. Clojure220827T031242ZnaffetS
1001389. ReScript220827T025330Zalephalp
192388. Racket220826T210210ZnaffetS
1984387. Cognate220818T212532Zchunes
1015368. Reason211207T063044Zalephalp
182385. Vyxal220703T010825ZnaffetS
1002383. Wenyan220622T041036ZShieru A
241382. Red220621T090633Zchunes
179381. Desmos220620T193530ZnaffetS
159336. Pip180220T154710ZPeter Ta
525121. Pip170827T080949ZPeter Ta
255380. Red220620T180041Zchunes
180379. Vyxal220620T171424ZnaffetS
494378. Factor220620T101230Zchunes
258377. Kitten220620T093257Zalephalp
235376. tinylisp220616T075327Zemanresu
231375. Factor220616T071505Zchunes
1091374. Halfwit220616T061310Zemanresu
907373. Idris220616T051404ZBubbler
170372. Vyxal220616T041349Zemanresu
224371. Factor220616T034115Zchunes
490370. Swahili220616T030844Zalephalp
163369. Add++220111T014536ZFmbalbue
178351. Quipu211110T150734Zalephalp
187367. Acc!!211206T163016ZDLosc
nan365. Sass211205T005529ZRadek
2534364. Wenyan 文言211121T052641Zalephalp
1669363. Iota211119T041525ZBubbler
324362. Pyramid Scheme211118T141207Zalephalp
272361. Excel Insider Beta211116T054557ZAxuary
215360. Zephyr211116T021018Zalephalp
169359. MOO211114T043341ZThe Fift
304358. CoffeeScript 2211113T141550Zalephalp
167357. Julia 1.0211112T140442ZMarcMush
703356. ArnoldC211111T165519ZAxuary
04086. Gaia170725T140840ZBusiness
244355. Pyret211111T150919Zalephalp
195354. 05AB1E legacy211111T105141ZKevin Cr
260353. Tampio imperative211111T064240Zalephalp
197352. MathGolf211110T154809ZKevin Cr
301344. Proton180228T020731ZVyxal Bo
166350. Husk210414T031618ZLegionMa
774349. Kotlin210413T211910Zfluffyyb
607348. Rust210113T200201ZAiden4
824347. Pure201230T201141ZCommand
0101. Triangular170721T150022Zcaird co
08515. CJam170721T190330ZPeter Ta
20189. PowerShell170725T223204ZPeter Ta
3780346. C++14 gcc180306T164502Zuser2027
162345. brainfuck180228T025601ZKhuldrae
382343. Hodor180227T173752ZKSmarts
164342. 05AB1E180227T012550ZShieru A
803341. Physica180226T201112ZMr. Xcod
206340. x86_64 assembly nasm180225T054813ZTyilo
209339. ><>180224T213948Zhakr14
287338. Triangularity180222T202117ZMr. Xcod
154337. Mathematica 11 Wolfram Language180222T171817ZKSmarts
620335. Python 2 Cython180217T060447Zuser2027
219333. Swift 3180210T182410ZMr. Xcod
157334. C tcc180210T190737ZJonathan
852332. tinylisp180210T152400Zuser2027
766331. Coconut180203T174736ZJonathan
155329. Yacas180130T115906ZChristia
1854330. Shakespeare Programming Language180130T144240ZMaya
222328. MYBASIC180128T231724ZJonathan
439327. tinylisp180128T211554ZDLosc
205326. Lua180128T170002ZJonathan
559324. Pyon180126T165458ZMaya
385325. Perl 6180126T180838ZKSmarts
238323. Common Lisp180126T155044ZKSmarts
150322. Mathematica 10.1180126T001736ZLegionMa
249321. Racket180125T202716ZJonathan
292319. C 8cc180125T043314ZMD XF
308320. Java 7180125T081915ZKevin Cr
1688318. Funciton180124T212159ZKSmarts
652317. Python 3 Cython180123T190117ZMaya
1808316. Pascal FPC180123T131058Zuser2027
147315. Befunge98 PyFunge180117T153016ZMaya
4166 314. M180117T075954Zuser2027
146313. PowerShell180115T103015ZPeter Ta
1811312. Python 2 PyPy180115T085820ZShieru A
334311. ALGOL 68 Genie180109T182629ZKSmarts
3025308. ENIAC simulator180108T133958Zleo3065
148310. Pyth180108T231708ZMr. Xcod
699309. Haskell180108T182841Zlynn
6060307. Scratch 2180108T063046ZPattuX
145305. JavaScript Node.js180107T210405ZIQuick 1
2113306. Python 3180108T015932ZShieru A
143304. Clojure180107T194402ZUriel
203303. APL Dyalog180107T190601Zleo3065
796124. ArnoldC170901T151116ZKSmarts
903132. Java OpenJDK 9170903T232147ZKSmarts
701137. Squirrel170906T000333ZKSmarts
142184. CJam170926T094908ZPeter Ta
110222. Julia 0.4171011T210534ZGiuseppe
135302. MOO180106T143221ZThe Fift
165301. Trefunge98 PyFunge180106T140356ZMaya
2407300. C# .NET Core180106T122533ZShieru A
137299. Unefunge98 PyFunge180103T161747ZMaya
1008298. dc180103T094016ZDLosc
1460297. Shakespeare Programming Language180103T040206ZShieru A
149289. Pyt171229T214420Zmudkip20
161296. Pyt180102T210108Zmudkip20
133295. Unefunge98 PyFunge171231T223928ZMaya
218294. Swift 3171231T192447ZMr. Xcod
65143. Swift 4170722T122721ZMr. Xcod
431293. Commodore 64 BASIC171231T184616ZMaya
562256. Pygmy Forth171120T172554ZMaya
329258. Forth gforth171121T094120ZMaya
132292. Gaia171231T100006ZMr. Xcod
130291. Whispers171230T070109Zcaird co
337290. Hy171230T063755ZDLosc
nan281. Java 5171224T025848Zuser2027
186288. Swift 4171225T195931ZMr. Xcod
nan287. Scratch 2171225T193430Zdylnan
1118286. Pyon171225T145339ZMaya
126282. Actually171224T142517ZMaya
211284. Hexagony171224T152702ZMaya
nan265. brainfuck171125T010132ZPattuX
06411. Pari/GP170721T173426ZMD XF
151285. Squirrel171224T162105ZNK1406
384283. Ohm v2171224T143415ZMr. Xcod
29081. Röda170724T204919ZETHprodu
947280. Axiom171217T021231Zpolitza
2852279. Fortran GFortran171214T223251Zdylnan
nan271. Java 6171207T192343Zhyperneu
332232. Funky171021T030809Zuser2027
5692278. Java 6171213T144027Zhyperneu
589194. ALGOL 68 Genie171002T135059ZKSmarts
113275. Whispers171207T201738Zcaird co
104277. 2sable171208T003241Zdylnan
2572266. UCBLogo171130T151759Zuser2027
188276. MATLAB171207T224320ZGiuseppe
129272. SNOBOL4 CSNOBOL4171207T194227ZGiuseppe
1021274. ArnoldC171207T200931ZKSmarts
123273. Ohm v2171207T195841ZMr. Xcod
141233. Hexagony171021T052722ZMaya
504260. BrainFlak171124T075758Zuser2027
213201. Nim171002T225642ZKSmarts
189200. shortC171002T213603ZMaya
068144. Chez Scheme170907T143710ZGiuseppe
120143. Excel170907T120859ZEngineer
029135. Husk170904T101433ZMr. Xcod
277134. Emoji170904T095701ZMaya
103270. Husk171130T215918ZMr. Xcod
118269. Pip171130T210015ZDLosc
099268. Pyke171130T184629ZMr. Xcod
338267. Erlang escript171130T182618ZMaya
102264. PowerShell171124T171933Ztotallyh
13112. Java OpenJDK 8170721T174215ZLeaky Nu
095215. MATL171010T143302ZGiuseppe
493263. Visual Basic .NET .NET Core171124T170605ZColera S
115261. Alice171124T083242ZMartin E
091262. Cubically171124T101611Zuser2027
1333259. Hy171124T074120ZDLosc
1516253. MIT/GNU Scheme171120T130234ZChristia
1147229. FMSLogo171020T143249Zuser2027
144257. TINSpire CX Basic171120T200938ZHusnain
454255. Perl 5171120T163241ZKSmarts
098254. Enlist171120T141552Zhyperneu
711250. Coconut171112T175925ZChristia
251252. Pari/GP171113T170436ZKSmarts
269251. C tcc171113T133657ZMaya
376157. C gcc170918T233523ZMD XF
171249. PicoLisp171107T161051ZGiuseppe
904248. Huginn171107T160027ZKSmarts
087247. Enlist171106T160040Zuser2027
240246. Coconut171106T154243ZKSmarts
1272245. Java 7171106T150121Zhyperneu
1524244. UCBLogo171106T133404Zuser2027
1344153. Emojicode170911T232912ZMaya
112243. Ly171031T095116ZChristia
111242. FriCAS171028T163418ZKSmarts
230241. Trefunge98 PyFunge171028T090318ZMaya
256240. CHICKEN Scheme171027T191806ZGiuseppe
4903226. Java 7171018T140009Zuser2027
429238. LOLCODE171027T145115ZKSmarts
089237. M171027T141410Zhyperneu
341236. Axiom171027T131057ZChristia
3295235. Pascal FPC171025T120029Zuser2027
512234. Rust171021T212808Ztotallyh
938231. Shakespeare Programming Language171020T150725ZMaya
086230. Cubix171020T144615ZGiuseppe
861227. C++ clang171018T170414Zhyperneu
361228. Hodor171018T173652ZKSmarts
080225. VBA171012T134504ZEngineer
1232224. Racket171012T095212ZChristia
088223. GolfScript171011T220210ZPeter Ta
670221. Pony171011T172919ZKSmarts
107220. Visual Basic .NET .NET Core171011T144501ZStephen
127219. Maxima171011T141920ZKSmarts
075208. Befunge 93171010T073822ZCinaski
702218. ExtraC171011T085313ZMaya
079212. JavaScript SpiderMonkey171010T134736Ztotallyh
174217. Mathematica171010T174854Ztotallyh
411216. BeanShell171010T160419ZMaya
383214. Julia 0.4171010T140842ZKSmarts
117213. Befunge98 PyFunge171010T135330ZMaya
076210. Pyth171010T125345ZMr. Xcod
078211. 05AB1E171010T130712Zhyperneu
100209. APL Dyalog171010T124149ZUriel
3275206. Proton171010T023331Zhyperneu
389207. ARBLE171010T035741ZATaco
053204. Positron171002T232800Zhyperneu
109205. Commata171003T010834Ztotallyh
096203. Julia 0.5171002T232229ZGiuseppe
050202. Oasis171002T230811ZStephen
056196. Java OpenJDK 9171002T154440ZStephen
092199. Kotlin171002T180956ZStephen
466198. Go171002T174614Ztotallyh
347197. D171002T163602ZKSmarts
210195. ><>171002T153156ZGrzegorz
1824191. Haskell171001T091642ZChristia
160193. Hodor171001T131216ZGrzegorz
326192. Emoji171001T123223ZMaya
725190. COBOL GNU170927T153651ZKSmarts
1182189. C# Visual C# Compiler170927T145043ZGrzegorz
105188. Groovy170926T161446ZStephen
321187. SageMath170926T150816ZKSmarts
177186. axo170926T140631Zhyperneu
017185. Octave170926T115551ZCinaski
061183. PostL170923T191750Zhyperneu
933178. GAP170923T090614ZChristia
134182. Common Lisp170923T174627ZThe Fift
276181. C clang170923T171602ZJonathan
063180. C tcc170923T150700ZMaya
062179. C clang170923T094610ZJonathan
2466156. C# Mono170918T225057ZPeter Ta
054174. C++ gcc170922T121521ZJonathan
214177. Lua170922T131949ZJonathan
184176. JavaScript ES6170922T125403ZStephen
122175. PHP170922T124336ZMaya
257173. Python 2 IronPython170922T111520ZMaya
055172. Python 1170922T102615ZJonathan
541171. TrumpScript170922T092607ZGrzegorz
204170. Python 3 PyPy170922T071038ZMaya
084169. Chez Scheme170921T144439ZGiuseppe
261168. Python 2 PyPy170921T143607ZKSmarts
101167. Magma170921T125344ZGrzegorz
638166. Scratch 2170919T194354ZThe Fift
114165. Forth170919T185146Zmbomb007
1000164. cQuents170919T164739ZStephen
227163. R170919T162936ZGiuseppe
448162. Julia 0.6170919T150022ZKSmarts
208161. Ruby170919T135855Zhyperneu
315160. Bash170919T100428Zirapsage
778159. Java OpenJDK 8170919T074327ZMaya
048158. Jelly170919T014429Zhyperneu
1993149. dash170915T163255ZPeter Ta
083155. Python 3170912T120133Ztotallyh
262154. Verilog170912T084805ZTom Carp
136152. Mathics170911T163923ZKSmarts
031151. Python 2170911T150642Ztotallyh
125150. Julia 0.6170911T150322ZGiuseppe
173148. Python 2 IronPython170908T125116ZStephen
695147. Elixir170908T094653ZMaya
121146. PicoLisp170907T175249ZGiuseppe
271145. Phoenix170907T173023ZStephen
782142. Erlang escript170907T093248ZMaya
918140. MATLAB170906T190102ZGiuseppe
039141. MOO170906T192051ZThe Fift
052139. Perl 6170906T153828ZStephen
689138. Chapel170906T150703ZMaya
643133. CHICKEN Scheme170904T050752ZHusnain
232136. A Pear Tree170904T122441ZMaya
116131. Bean170903T005653ZMaya
090130. TINspire CAS Basic170902T191043ZHusnain
482129. ExtraC170902T174325ZMaya
082128. Groovy170902T172253ZStephen
058127. Alice170902T164651ZNitrodon
156126. Scala170902T155503ZStephen
655125. BeanShell170902T133536ZMaya
278123. Emojicode170901T140310ZMaya
2057122. MIT/GNU Scheme170901T133348ZChristia
128118. Ly170822T132132ZChristia
022120. MATL170822T150541ZCinaski
139119. bc170822T142635ZFelipe N
106117. Rail170819T165932ZThe Fift
1156116. Kotlin170819T082856ZPeter Ta
273115. shortC170818T190702ZMD XF
1560114. Crystal170818T182923ZChristia
228113. Arcyóu170816T134624ZThe Fift
049112. Retina170815T192702ZBusiness
042111. Ceres170815T192336Zhyperneu
442110. Nim170815T191513ZKSmarts
081109. brainfuck170815T173432ZMaya
032108. Proton170815T162037Zhyperneu
1589107. TrumpScript170815T161448ZMaya
335101. Fortress170811T220834ZAdalynn
nan106. ObjectiveC clang170814T144955ZStephen
nan105. Windows Batch170814T143922ZBrian J
267104. Vala170814T141712ZLeaky Nu
98222. FiM++170721T222803ZBlackCap
713103. VB6170814T104740ZBrian J
158102. Perl 5170812T123643ZPeter Ta
020100. Pyke170811T191915ZMr. Xcod
177297. Python 3 PyPy170806T031458Zhyperneu
03099. Spaced170811T191009ZBusiness
15398. Befunge98 PyFunge170811T122800ZThe Fift
02794. Befunge 93170731T004603Zhyperneu
23696. Common Lisp170731T013610ZThe Fift
47895. Taxi170731T005640ZStephen
03593. Clojure170731T002317ZUriel
09392. Thue170731T002237ZThe Fift
173391. Python 2 PyPy170730T225334Zhyperneu
341640. Rust170722T075121Zlynn
06690. Open Shading Language OSL170725T225035ZScott Mi
38688. Go170725T150335ZUriel
01687. Neim170725T141845Ztotallyh
09785. TypeScript170725T131452ZStephen
33084. Boo170725T124418ZBlackCap
nan83. Bash170725T034602ZHusnain
01482. Cubix170724T205353ZGiuseppe
nan80. Mathics170724T183446ZKSmarts
01379. Commentator170724T164651Zcaird co
01278. anyfix170724T164502Zhyperneu
05177. Braingolf170724T162318ZMayube
414776. Pygmy170724T161253ZPeter Ol
03675. GolfScript170724T061915ZPeter Ta
07774. Racket170723T235931ZBusiness
36373. Starry170723T233931ZNot a tr
25272. SML170723T211413ZPeter Ta
40171. F# Mono170723T193010ZETHprodu
113470. Elm170723T170150ZBlackCap
33369. GAP170723T114813ZChristia
76168. Pascal FPC170723T095721ZLeaky Nu
83767. LOLCODE170723T082108ZBlackCap
13856. Pony170722T172333ZBlackCap
04366. Yacas170723T062003Zalephalp
37165. Fortran GFortran170723T053948ZLeaky Nu
15264. LiveScript170722T231201ZBlackCap
10863. Haxe170722T225237ZETHprodu
05762. S.I.L.O.S170722T200707ZMr. Xcod
00561. √ å ı ¥ ® Ï Ø ¿170722T195638Zcaird co
52760. Oasis170722T195323ZAdnan
05959. Brachylog170722T193435ZLeaky Nu
01158. 2sable170722T181830Zhyperneu
02421. M170721T212442Zhyperneu
11957. Desmos170722T174805ZScott Mi
04155. ><>170722T164559Zfireflam
19654. C# .NET Core170722T162649ZStephen
03453. Coffeescript170722T162301ZBlackCap
48452. Ceylon170722T161833Zhyperneu
02650. Japt170722T154045ZETHprodu
00851. Burlesque170722T160045Zalephalp
19447. awk170722T133739Zyoann
07449. SageMath170722T144755Zalephalp
00348. SOGL170722T140316Zdzaima
02146. Jellyfish170722T131728Zcaird co
19045. D170722T130555ZLeaky Nu
09444. Maxima170722T125148Zalephalp
02842. Cheddar170722T111917ZLeaky Nu
50341. PHP170722T110715ZBlackCap
00139. Add++170722T071045Zcaird co
00438. Actually170722T070815Zalephalp
00637. 05AB1E170722T064309ZMr. Xcod
12436. J170722T063808ZLeaky Nu
06735. dc170722T055220ZR. Kap
16834. Prolog SWI170722T053256ZLeaky Nu
07333. Octave170722T043938ZGiuseppe
17231. Joy170722T041952Zalephalp
21632. C gcc170722T042526ZLeaky Nu
111230. Python 1170722T025659Zhyperneu
04629. JavaScript SpiderMonkey170722T005936ZETHprodu
00928. Positron170722T004941Zhyperneu
58427. C++170722T004614ZSilvio M
27426. TIBASIC170722T003127ZScott Mi
18325. eta170721T232928ZBlackCap
03324. Julia 0.5170721T230334Zlynn
02323. Ruby170721T225051ZJustin
01520. cQuents170721T205408ZStephen
04519. Curry170721T201155ZBlackCap
03718. APL Dyalog170721T200102Zuser4180
01817. Stacked170721T191935ZConor O&
06916. Lua170721T190929ZLeaky Nu
124613. VB.NET .NET 4.5170721T180812ZBrian J
06014. Python 2170721T181222Ztotallyh
06510. Magma170721T171922Zhyperneu
0199. Pyth170721T164101ZLeaky Nu
0024. Jelly170721T152311ZErik the
0725. Python 3170721T153137ZMr. Xcod
0707. BrainFlak170721T154053ZWheat Wi
0716. R170721T153657ZLeaky Nu
0258. Mathematica 10.1170721T155111ZLegionMa
0383. JavaScript ES6170721T152122ZETHprodu
0442. Haskell170721T151149ZBlackCap

408. Whitespace, 801 bytes, A000373

sssnsssntntttttsssnssstnttsssstntssssnsnstnsntsnsssstntsstssstsntstsssstntssssssnssstnnsstnsnsstssttntsstntsssnsssnsssnnssstnsntstsstnstssttnnstsnsnstssnstsstsnttttssnstssttnstssttntsssssstsntsttssstsntssnssstntssttssntssssntssstntssssnsstssttntsstnttstnsnnstsstnstsstnttssnsssstntsstntstsnnssttnstsstnssstsntssnssstntsssnstnstsststnstssttnssstsntssntsstsssnsssnnsssssnsntstsststnssstntsstsnsstssttntsssnstsnstsststntsssstsststsntssnstsstsnnstnstsststntssnstsststsnstsstssntsststsstsssnssstsntssntsstssstntsstnstntssntststssssntssstntssssnsstssttntsstnttsssnsnnstnsttnsntsssnsntttstssssssntttsssnssstnttsssstntsssnsntnnssssnsnntnstssststsntnssnnnnsstsnsnnsssnnsnttnnssnssstnnsssstnstsstnsnsntsstsntssnsntssstntsstsntnsnsstnnssstsnsntstnstsnntnnsssnsnsnstnsntstsstsntsstnstnstsstsnnstntssntstsstnstnntn

s = space, t = tab, n = newline

Try it online!

Next sequence!

I don't know if anyone is looking at this anymore, but I didn't want the chain to die on an abstruse and nebulous sequence. This code is horribly written and quite inefficient, but it gets the job done and was a fun challenge to write. It's really just my best attempt at translating this Python program:

from math import comb, factorial as fact
def moufang(n):
    A = [1]
    res = 0
    for k in range(1, (n-1)//2 + 1):
        a = 0
        for r in range(k):
            x = comb(k,r)**2 * A[r]
            if (r+k) % 2 == 0:
                x *= -1
            a += x
        A.append(a)
        if a == 1:
            a = 0
        for p in range(n - 2*k):
            res += (fact(n) * (a+comb(p+k-1,k-1))
                // (fact(p)*fact(2*k+1)*fact(n-p-2*k-1)))
    return res

which was itself derived from the PARI program listed on the sequence entry.

239. Boo, 346 bytes, A000429

import System.Numerics
def f(n as long,k as long):
 p=BigInteger(1);for i in range(n,n-k):p*=i
 if k>1:
  for i in range(k,1):p/=i
 return p
def b(n as long,i as long,k as long)as long:
 s=0;if n<1:return 1
 if i<1or k<1:return 0
 t=b(i-1,i-1,k-1);for j in range(0,n/i+1):s+=f(t+j-1,j)*b(n-i*j,i-1,k)
 return s
def a(n):
 return b(n,n,8)-b(n,n,7)

Next sequence!

Try it online!

386. Zig, 350 bytes, A000182

fn a000182(comptime n: comptime_int) [n]i64 {
    var s = [_]i64{0} ** n;

    s[0] = 1;

    for (s[1..]) |*a, i| {
        a.* = @intCast(i64, i + 1) * s[i];
    }

    for (s[1..]) |_, i| {
        for (s[i + 1 ..]) |*a, j| {
            a.* *= @intCast(i64, j + 2);
            a.* += @intCast(i64, j) * s[i + j];
        }
    }

    return s;
}

Attempt This Online!

Next sequence!

Uses the Zig language because the sequence is called the Zag numbers.


The above code was written in some old version of Zig (I can't remember which one, maybe 0.9.1). It does not work in Zig 0.11.0 or later, because Zig's for loop syntax has changed. I will not update the code because that would change the byte count.

407. Dart, 373 bytes, A000198

import 'dart:math';

int f(int n) {
  int d = 0;
  int k = -1;
  for (int i = 1; i < 4; i++) {
    d = 3 * i - 1 - i % 2;
    var c = log(n / d) / log(3);
    if (c.ceil() == c) {
      k = c.ceil();
      break;
    }
  }
  return k < 0
      ? List.generate(n - 1, (i) => f(i + 1) * f(n - i - 1)).reduce(max)
      : d * pow(3, (d * pow(3, k) - min(5, d)) / 2).ceil();
}

Next sequence!

Dart's first time here!

I avoided "choosing" the next sequence: the code was implemented using single-character variables and formatted using DartPad.

Implements the following formula available on OEIS:

a(3^k) = 3^((3^k - 1)/2)
a(5*3^k) = 5*3^((5*3^k - 5)/2)
a(7*3^k) = 7*3^((7*3^k - 5)/2)
for all other n, a(n) = max(a(i)a(n-i)),
  where the maximum is taken over 1 <= i <= n-1
(from Alspach and Berggren (1973) Theorem 4).

Try it online!

406. Symja, 198 bytes, A000175

(* Based on Herman Jamke's second PARI/GP code on OEIS *)
A000175(n_) := 2 ^ (2 * n - 1) * Product(k ^ Floor(n / k), {k, 1, n}) * SeriesCoefficient(BesselJ(1, x) / BesselJ(0, x), {x, 0, 2 * n - 1});

Next sequence!

Try It Online!

Symja is a Java Symbolic Math System. Its syntax is basically the same as Mathematica, except it uses round brackets instead of square ones.

366. HOPS, 202 bytes, A000207

catalan_numbers = 1 + x * catalan_numbers ^ 2;   a000207 = (1 - 12 * x - (1 - 4 * x) * catalan_numbers(x) + 3 * x * (3 + 2 * x) * catalan_numbers(x ^ 2) + 4 * x ^ 2 * catalan_numbers(x ^ 3)) / (12 * x)

Next sequence!

Attempt This Online!

HOPS is an extremely powerful language for sequences: you input the generating function, it outputs the sequence. You can even define the generating function using recursion.

405. Cognate, 175 bytes, A000309

Def Fact (
   Let N be the input;
   For Range from 1 to + N 1 (*) 1
);

Def as A000309 (
   Let N be the input;
   * ^ N 2 Fact * 3 N;
   * Fact + 1 * 2 N Fact + 1 N;
   /
);

Attempt This Online!

Next sequence!

404. Raku, 309 bytes, A000234

sub a($i, $m, $k) {
  if ($k == 1) {
    return 1;
  }
  my $s = 0;
  my $l = floor($m ** (3 / 2));
  for 1..min($l, $i) -> $j {
    my $m2 = $m - $j ** (2 / 3);
    if ($m2.floor >= 1) {
      $s += a($j, $m2, $k-1);
    }
    $s += 1;
  }
  return $s;
}

my $n = get;

print a(floor($n ** (3 / 2)), $n, $n);

Try it online!

Next sequence!

403. Quipu, 234 bytes, A000254

" 0&  1&  2&  3&  4& "
"--------------------"
  \/  1&  1&  1&  2&
  1&  ++  []  ++  []
  ++  0&  **  1&  /\
      []  3&  []    
      %%  []  **    
      4&  ++  1&    
      ==  1&  --    
          ++  1&    
              ??    

Next sequence!

Attempt This Online!

402. Crystal, 254 bytes, A000303

def a000303(n)
  # BYTE COUNT HAS TO GET BIGGR
  # BYTE COUNT HAS TO GET BIGGR
  # BYTE COUNT HAS TO GET BIGGR
  (1..n).to_a
        .permutations
        .count { |x|
          x.chunk_while { |a, b| a < b }
           .max_of(&.size) == 2
        }
end

Try it online!

Next sequence!

Ruby has the perfect builtins for this, and Crystal is very similar to Ruby, so it does too.

401. HOPS, 303 bytes, A000314

exponential_generating_function_of_a035351 = x * exp((2 * exponential_generating_function_of_a035351 - exponential_generating_function_of_a035351 ^ 2) / (2 - 2 * exponential_generating_function_of_a035351));  a035351 = laplace(exponential_generating_function_of_a035351);  a000314 = 1 + int(a035351 / x)

Next sequence!

Attempt This Online!

Or 36 bytes: a=x*exp((a+a/(1-a))/2);1+a.*{(n-1)!}.

400. Prolog (SWI), 314 bytes, A000279

Thanks @user for helping me debug my code in the Prolog chat room!

factorial(0,1).
factorial(N,X):-
	A is N-1,
	factorial(A,B),
	X is B*N.

choose(N,R,X):-
	K is N-R,
	factorial(N,A),
	factorial(R,B),
	factorial(K,C),
	X is A/(B*C).

a(_,0,0).
a(N,K,X):-
	A is K-1,
	a(N,A,B),
	choose(N,K,C),
	choose(N,A,D),
	G is N-1,
	choose(G,A,E),
	X is B+3*N*C*D*E.

a000279(N,X):-
	a(N,N,X).

400th answer yay!

Try it online!

Next Sequence!

384. Clean, 798 bytes, A001002

import StdEnv

:: Series a = (:+) infixr 6 a (Series a)

coeff :: Int (Series a) -> a
coeff 0 (a :+ _ ) = a
coeff n (_ :+ as) = coeff (n - 1) as

truncate :: Int (Series a) -> [a]
truncate 0 _         = []
truncate n (a :+ as) = [a : truncate (n - 1) as]

instance zero (Series a) | zero a where
    zero = zero :+ zero

instance one (Series a) | one a & zero a where
    one = one :+ zero

instance + (Series a) | + a where
    (+) (a :+ as) (b :+ bs) = (a + b) :+ (as + bs)

instance * (Series a) | + a & * a where
    (*) (a :+ as) (b :+ bs) = (a * b) :+ (as * (b :+ bs) + a ** bs)

(**) :: a (Series a) -> Series a | * a
(**) a (b :+ bs) = a * b :+ a ** bs

x :: Series a | one a & zero a
x = zero :+ one :+ zero

A001002 :: Series Int
A001002 = one :+ (A001002 * A001002 * (one + x * A001002))

Try it online!

Next sequence!

Its generating function satisfies \$A = 1 + x A^2 + x^2 A^3\$.

Clean is very similar to Haskell: purely functional, lazy, currying, operator overloading with type classes. So I can borrow this Haskell implementation of formal power series.

399. PARI/GP, 279 bytes, A000176

D(b,n)=(-1)^(n-1)*if(b%4==1,sum(k=1,(b-1)/2,kronecker(k,b)*(b-4*k)^(2*n-1)),sum(k=0,(b-1)\2,kronecker(b,2*k+1)*(b-2*k-1)^(2*n-1)))
d(a)=my(m,b);[b,m]=core(a,1);if(m>1,if(b>1,1,1/2)*m^7*prod(p=3,m,if(isprime(p)&&!(m%p),(p^4-kronecker(b,p))/p^4,1))*d(b),b==1,2,D(b,2)+3*b^2*D(b,1))

Attempt This Online!

Next sequence!

Using the formula on A000061, or in this paper.

398. GeoGebra, 176 bytes, A000498

inputVariable = 0
InputBox( inputVariable )
Sum( nCr( inputVariable + 5 , k0 ) * ( -1 ) ^ k0 * ( inputVariable + 1 - k0 ) ^ ( inputVariable + 4 ) , k0 , 0 , inputVariable + 1 )

Takes input through the input box.

Try It On GeoGebra!

Next Sequence!

397. Go, 498 bytes, A000185

import ."math"

func fact(n float64) float64 {
  res := 1.0
  for i := 1.0; i <= n; i++ {
    res *= i
  }
  return res
}

func binomial(n float64, k float64) float64 {
  return fact(n) / (fact(k) * fact(n-k))
}

func A000185(ki int64) int64 {
  s := 0.0
  k := float64(ki)
  n := k + 5.0
  for j := 0.0; j <= k; j++ {
    s += Pow(-1.0, float64(j)) *
         (2.0 * n * fact(k - j) / float64(n + k - j)) * binomial(n - k + j, n - k) * binomial(n + k - j, n - k + j)
  }
  return int64(Round(s))
}

Attempt This Online!

Next sequence!

Since \$A000185(n)\$ = \$A058087(n+5,n)\$, I used the formula by G. C. Greubel on OEIS to calculate A058087+

$$A058087(n,k) = \sum_{j=0}^k (-1)^j\frac{2n(k-j)!}{n+k-j}{{n-k+j}\choose{n-k}}{{n+k-j}\choose{n-k+j}}$$

Therefore:

$$A000185(k) = \sum_{j=0}^k (-1)^j\frac{2(k+5)(k-j)!}{2k+5-j}{{5+j}\choose{5}}{{2k+5-j}\choose{5+j}}$$

396. Desmos, 185 bytes, A000424

A_{000424} \left(  i_{nputVariable}  \right) = \left( i_{nputVariable} + 1 \right)!^{2} \cdot \sum_{m=1}^{i_{nputVariable}+1} \left( \sum_{k=1}^{m} \frac{1}{k} \cdot \frac{1}{m} \right)

Try It On Desmos!

Next Sequence!

395. Knight, 424 bytes, A000248

; = factorial BLOCK
    IF (< num 2)
        1
        (* num (; (= num (- num 1)) (CALL factorial)))
; = choose BLOCK
    ; = num n
    ; = numerator (CALL factorial)
    ; = num k
    ; = den (CALL factorial)
    ; = num (- n k)
    ; = den (* den (CALL factorial))
    : / numerator den
; = n (EVAL PROMPT)
; = k 0
; = s 0
; WHILE (< k (+ 1 n))
    ; = s (+ s (* (CALL choose) (^ (- n k) k)))
    : = k (+ 1 k)
: OUTPUT s

Try it online!

Next sequence!

394. kalker, 248 bytes, A000181

f(n) = Σ(i = 0, n, (-1)^i (n + 4) (n - i)! (2 n + 3 - i)! / (12 i! (2 n - 2 i)!))
f(n) = Σ(i = 0, n, (-1)^i (n + 4) (n - i)! (2 n + 3 - i)! / (12 i! (2 n - 2 i)!))
f(n) = Σ(i = 0, n, (-1)^i (n + 4) (n - i)! (2 n + 3 - i)! / (12 i! (2 n - 2 i)!))

Try it online!

Next sequence!

Kalker is a scientific calculator that supports math-like syntax with user-defined variables, functions, derivation, integration, and complex numbers.

Since writing the definition once is too short, I write it three times.

391. Egison, 374 bytes, A000191

-- The egf (exponential generating function) of the sequence
def egf := 2 * sin t / (2 * cos (2 * t) - 1)

-- Repeatedly applies the differential operator to the egf, and substitutes t with 0
def a000191List := map (substitute [ (t,0) ]) $ iterate (flip d/d t) egf

-- Takes the 2 * (n + 1)'th term, because Egison is 1-indexed
def a000191 n := nth (2 * (n + 1)) a000191List

Try it online!

Next sequence!

The exponential generating function of the sequence is \$2\sin(t)/(2\cos(2t)-1)\$. Here I use symbolic differentiation again, but using Egison's built-in d/d function. Still very inefficient.

Egison is a functional programming language featuring its expressive pattern-matching facility. It can also be used as a Computer Algebra System.

393. Red, 181 bytes, A000212

Red[
    title: "OEIS A000212"
    author: "chunes"
    date: 2022-08-29
    tabs: 4
    version: 0.6.4
    company: ""
    rights: "nein"
]

f: func[n][to 1 round/down(n ** 2 / 3)]

Try it online!

Next sequence!

392. Ruby, 212 bytes, A000374

def order(k, n)
  m = 1
  loop {
    return m if k.pow(m, n) == 1
    m += 1
  }
end

def a000374(n)
  (3..n).sum { |d| n % d < 1 && d.odd? ?
    (1..d).count { |x| x.gcd(d) == 1 } / order(2, d) :
    0 } + 1
end

Attempt This Online!

Next sequence!

390. Clojure, 191 bytes, A001001

(defn divisors
  [n]
  (filter
    #(zero?
     (rem n %))
    (range 1
      (+ 1 n))))

(defn a001001
  [n]
  (->> n
    (divisors)
    (map #(* % (reduce + (divisors %))))
    (reduce +)))

Try it online!

Next sequence!

389. ReScript, 1001 bytes, A000192

type rec expr =
  | Const(int)
  | X
  | Cos(expr)
  | Sin(expr)
  | Add(expr, expr)
  | Mul(expr, expr)
  | Div(expr, expr)

let rec eval_at_0 = (e: expr): int =>
  switch e {
  | Const(c) => c
  | X => 0
  | Cos(_) => 1
  | Sin(_) => 0
  | Add(e, f) => eval_at_0(e) + eval_at_0(f)
  | Mul(e, f) => eval_at_0(e) * eval_at_0(f)
  | Div(e, f) => eval_at_0(e) / eval_at_0(f)
  }

let rec deriv = (e: expr): expr =>
  switch e {
  | Const(_) => Const(0)
  | X => Const(1)
  | Cos(e) => Mul(Const(-1), Mul(deriv(e), Sin(e)))
  | Sin(e) => Mul(deriv(e), Cos(e))
  | Add(e, f) => Add(deriv(e), deriv(f))
  | Mul(e, f) => Add(Mul(deriv(e), f), Mul(e, deriv(f)))
  | Div(e, f) =>
    Div(Add(Mul(deriv(e), f), Mul(Const(-1), Mul(e, deriv(f)))), Mul(f, f))
  }

let rec iter = (f, a, n: int) => n > 0 ? f(iter(f, a, n - 1)) : a

let egf: expr = Div(
  Mul(Const(2), Cos(Mul(Const(3), X))),
  Add(Mul(Const(2), Cos(Mul(Const(4), X))), Const(-1)),
)

let a000192 = (n: int) => eval_at_0(iter(deriv, egf, 2 * n))

Try it online!

Next sequence!

The exponential generating function of the sequence is \$2\cos(3x)/(2\cos(4x)-1)\$. Here I compute the sequence using symbolic differentiation. Very inefficient.

ReScript is a rebranding and cleanup of Reason, so I can reuse the Reason code for A000187 with some small modification.

388. Racket, 192 bytes, A001984

(define (f n)
; AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  (list-ref '(
      7
     23
     71
    311
    479
   1559
   5711
  10559
  18191
  31391
 307271
 366791
 366791
2155919) n))

Try it online!

Since the sequence is erroneous, I hardcoded it.

Next sequence!

387. Cognate, 1984 bytes, A000350

~~ First some helper words to make the prose flow like water.

Def Equal as (==);
Def Zero as (Equal to 0);
Def Positive to be (> 0);
Def Sum as (+);
Def Less as (- 1);
Def Last as (Modulo 10);
Def Quotient as (Floor /);
Def Mutable as (Box);
Def Value as (Unbox);

~~ Now we are ready to rumble.

Def Fibonacci as (
   Let N be the term we wish to find;
   Let A be a Mutable value of 0;
   Let B be a Mutable value of 1;
   do the following (
      put the Value of B aside for now;
      Set B to the Sum of the Value of A and the Value of B;
      A; should now be Set to the old value of b we put aside;
   ); N; Times;
   return the Value of A
);

Def Increment as (
   Let N be a mutable variable containing the input;
   Set N to the Sum of 1 and the Value of N
)

Def Chop as (
   Let N be a mutable variable containing the input;
   Set N to the Quotient of 10 and the Value of N;
);

Def End as (
   Let A be the first Integer!;
   Let B be the second Integer!;
   return whether the Last digit of A; and the Last digit of B; are Equal
);

~~ This is a function that determines whether its input is a member of OEIS: A000350.
Def Ends as (
   Let N be a Mutable variable containing the input;
   Let K be a Mutable variable containing the Fibonacci Value of N;
   While (the Value of N; is Positive; and the Value of N and the Value of K; End with the same digit; are Both true) (
      Chop the last digit off N;
      Chop the last digit off K;
   );
   return whether the Value of N; is Zero
);

Def A000350 as (
   Let N be the term of the sequence we want to find;
   Let K be the Mutable number of terms we've found starting with 0;
   Let M be a Mutable number to test for membership starting with 0;
   Until (the Value of K; and N; are Equal) do the following (
      Do either of the following-
      If the mth fibonacci number Ends with the Value of M then (Increment K) otherwise (do nothing);
      Increment M;
   );
   return one Less than the Value of M
);

Attempt This Online!

Cognate is a new stack language that is unique in that it reads right to left (superficially giving it the appearance of Polish notation). But using the ; word, you can ; make ; it ; read ; left ; to ; right. Having such fine-grained control over the flow of data makes it really easy to take advantage of Cognate's seamless comments (anything lowercase) to make things sound like English.

Mind you, this is incredibly overwrought -- you should probably never go this far with the natural language stuff -- but I got addicted to making it sound like English and wanted to see how far I could push it.

Next sequence!

368. Reason, 1015 bytes, A000187

type expr =
  | Const(int)
  | X
  | Cos(expr)
  | Sin(expr)
  | Add(expr, expr)
  | Mul(expr, expr)
  | Div(expr, expr);

let rec eval_at_0 = (e: expr): int =>
  switch (e) {
  | Const(c) => c
  | X => 0
  | Cos(_) => 1
  | Sin(_) => 0
  | Add(e, f) => eval_at_0(e) + eval_at_0(f)
  | Mul(e, f) => eval_at_0(e) * eval_at_0(f)
  | Div(e, f) => eval_at_0(e) / eval_at_0(f)
  };

let rec deriv = (e: expr): expr =>
  switch (e) {
  | Const(_) => Const(0)
  | X => Const(1)
  | Cos(e) => Mul(Const(-1), Mul(deriv(e), Sin(e)))
  | Sin(e) => Mul(deriv(e), Cos(e))
  | Add(e, f) => Add(deriv(e), deriv(f))
  | Mul(e, f) => Add(Mul(deriv(e), f), Mul(e, deriv(f)))
  | Div(e, f) =>
    Div(
      Add(Mul(deriv(e), f), Mul(Const(-1), Mul(e, deriv(f)))),
      Mul(f, f),
    )
  };

let rec iter = (f, a, n: int) => n > 0 ? f(iter(f, a, n - 1)) : a;

let egf: expr =
  Div(
    Add(Cos(Mul(Const(2), X)), Cos(Mul(Const(4), X))),
    Cos(Mul(Const(5), X)),
  );

let a000187 = (n: int) => eval_at_0(iter(deriv, egf, 2 * n));

Try it online!

Next sequence!

The exponential generating function of the sequence is \$(\cos(2x)+\cos(4x))/\cos(5x)\$. Here I compute the sequence using symbolic differentiation. Very inefficient.

385. Vyxal, 182 bytes, A000798

ɾṗꜝṗ'fUL?=;'2↔:ƛfUs;$ƛƒ↔Us;ꜝ∪$F¬;L
############################
#############################
#############################
#############################
############################

Try it Online!

Next sequence.

383. Wenyan, 1002 bytes, A000241

吾嘗觀「「算經」」之書。方悟「取底」之義。

吾有一術。名之曰「減之取半」。欲行是術。必先得二數。曰「甲」。曰「乙」。乃行是術曰。
 批曰。「「減甲以乙,半之,捨其餘數即得。」」
 減「甲」以「乙」。除其以二。名之曰「丙」。
 施「取底」於「丙」。乃得矣。
是謂「減之取半」也。

吾有一術。名之曰「甲零零零貳肆壹」。欲行是術。必先得一數。曰「甲」。乃行是術曰。
 注曰。「「即OEIS序列A000241也。完全圖之交點之數也,故人嘗尋其通解而不得要領,今解皆臆測也。」」
 吾有二數。曰一。曰零。名之曰「積」。曰「減」。
 為是四遍。
  施「減之取半」於「甲」於「減」。乘「積」以其。昔之「積」者。今其是矣。
  加「減」以一。昔之「減」者。今其是矣。
 云云。
 除「積」以四。乃得矣。
是謂「甲零零零貳肆壹」也。

IDE Next sequence

Uses the conjectured formula

$$\operatorname{A000241}(n)=\frac14\left\lfloor\frac{n}2\right\rfloor\left\lfloor\frac{n-1}2\right\rfloor\left\lfloor\frac{n-2}2\right\rfloor\left\lfloor\frac{n-3}2\right\rfloor$$

because the underlying problem remains open.

Add this snippet to show the first 13 terms (from 0 to 12)

吾有一數。曰零。名之曰「試」。
為是十三遍。
 施「甲零零零貳肆壹」於「試」。書之。
 加「試」以一。昔之「試」者。今其是矣。
云云。

382. Red, 241 bytes, A000179

Red[]

A000179: function [x][
    if x < 3 [return pick [1 -1 0] x + 1]
    x: x - 2
    a: -1
    b: 0
    repeat n x [
        n: n + 2
        c: a
        a: b
        b: (n ** 2 - (2 * n)) * b + (n * c) - (-1 ** n * 4) / (n - 2)
    ]
]

Try it online!

Next sequence!

381. Desmos, 179 bytes, A000255

a ( n_{nnnnnnnnnnnnnnnnnnnnnnnnnn} ) = \sum_{k = 0} ^ {n_{nnnnnnnnnnnnnnnnnnnnnnnnnn}} ( -1 ) ^ k ( n_{nnnnnnnnnnnnnnnnnnnnnnnnnn} - k + 1 ) n_{nnnnnnnnnnnnnnnnnnnnnnnnnn} ! / k !

$$ a(n)=\sum_{k=0}^n(-1)^k(n-k+1)n!/k! $$

Try it on Desmos!

Next sequence.

336. Pip, 159 bytes, A000620

b:[1]
c:[1]
Fi1,a+1{
 d:0
 e:2*(i%3%2)*c@(i/3)
 Fj,i{
  Fk,i-j{
   Ij=k{ d+:b@j * b@(i-j-k-1) }
   e+:c@j * c@k * c@(i-j-k-1)
  }
 }
 bAE:d
 cAE:e//3
}
c@v-b@v

Online demo

Next sequence


Basically this uses A000620 = A000625 - A000621 and the generating function relations for A000625 and A000621. I'm no chemist, but by the power of species theory I think I can reverse engineer the logic behind the g.f. relations, at least for one interpretation of the sequences. We're interested in monosubstituted alkanes, which correspond to graphs which are trees where every node has valence 4 (carbon atom) or 1 (either hydrogen atom or the substituted part, X).

In other words, modulo the trivial cases, we have a marked carbon atom which is attached to X:

   X
   |
a--C--b
   |
   d

The 3D geometry is relevant to the symmetries. The carbon atom is at the centre of a tetrahedron, and the other four elements are at the four vertices. Rotating around the axis CX doesn't change the molecule, so we'll need to avoid double-counting.

Note that if we consider the diagram from the perspective of e.g. a, the rest of the diagram (CXbd) can be considered as an X, and that's the heart of the recurrence logic.

If we ignore all restrictions and symmetry then by elementary species theory we have a generating function with recurrence \$F(x) = 1 + xF(x)^3\$. The \$1\$ corresponds to the special case that there's one molecule with 0 carbon atoms (X); the \$xF(x)^3\$ says that a molecule with \$n\$ carbon items can be identified with a molecule with one (\$x^1\$) identified carbon atom and then the remaining \$n-1\$ carbons are supplied by three smaller instances of the same type of object (a, b, d).

A000621 counts the non-stereoisomeric molecules. That means that they're symmetric: a = b, and all of a, b, d are non-stereoisomeric1. That gives generating function \$G(x) = 1 + xG(x)G(x^2)\$. The \$x\$ corresponds to the identified carbon atom C; the \$G(x)\$ corresponds to d; and the \$G(x^2)\$ corresponds to a and b being equal. (It uses \$x^2\$ to count each carbon atom in a twice).

A000625 counts all molecules under the rotational symmetry about the axis CX. If a, b, d are all different then there are three rotational positions, so we need to divide by 3; if two of them are the same then there are still three rotational positions; if all three are the same then there is only one rotational position, so we don't want to divide by three. We have g.f. \$H(x) = 1 + \frac13 xH(x)^3 + \frac23 xH(x^3)\$ where the final term is to bring the weight of the case where a=b=d back up from \$\frac13\$ to \$1\$.


1 Actually the choice that a = b is arbitrary, but works out nicely. We could alternatively consider the cases a = d and b = d as well, but then we have to divide by 3 to account for the symmetry.

121. Pip, 525 bytes, A000022

n:(a+1)//2
t:[[0]RL(3*a+3)PE1]
Fh,n{
  m:([0]RL(3*a+3))
  Fi,(a+1){
    Fj,(a+1){
      Fk,(a+1)m@(i+j+k)+:(t@h@i)*(t@h@j)*(t@h@k)
      m@(i+2*j)+:3*(t@h@i)*(t@h@j)
    }
    m@(3*i)+:2*(t@h@i)
  }
  t:(tAE(m//6PE1))
}
k:t@n
o:0
Fh,aFi,aFj,aI(h+i+j<a)o+:(k@h)*(k@i)*(k@j)*k@(a-1-h-i-j)
Fh,((a+1)//2){
  Fi,aI(2*h+i<a){o+:6*(k@h)*(k@i)*(k@(a-1-2*h-i))}
  I(a%2=1)o+:3*(k@h)*(k@((a-1-2*h)//2))
}
Fh,((a+2)//3)o+:8*(k@h)*(k@(a-1-3*h))
I(a%4=1)o+:6*k@(a//4)
o//:24
Ia(o+:t@n@a)
Fh,nFj,(a+1)o-:(t@(h+1)@j-t@h@j)*(t@(h+1)@(a-j))
o

Online demo

Next sequence

Fun fact: when the challenge was first posted, I drew up a list of small nasty sequence numbers that I wanted to aim for with CJam, and A000022 was at the top of the list.

This implements the generating function described in E. M. Rains and N. J. A. Sloane, On Cayley's Enumeration of Alkanes (or 4-Valent Trees), Journal of Integer Sequences, Vol. 2 (1999), taking the sum for Ck to as many terms as a necessary for the nth coefficient to be fixed and then telescoping three quarters of the sum. In particular, telescoping the first half means that the cycle index of S4 only has to be applied to one of the Th rather than to all of them.

The code breaks down as

; Calculate the relevant T_h
t:[[0]RL(3*a+3)PE1]
Fh,n{
  m:([0]RL(3*a+3))
  Fi,(a+1){
    Fj,(a+1){
      Fk,(a+1)m@(i+j+k)+:(t@h@i)*(t@h@j)*(t@h@k)
      m@(i+2*j)+:3*(t@h@i)*(t@h@j)
    }
    m@(3*i)+:2*(t@h@i)
  }
  t:(tAE(m//6PE1))
}

; Calculate the cycle index of S_4 applied to the last one
k:t@n
o:0
Fh,aFi,aFj,aI(h+i+j<a)o+:(k@h)*(k@i)*(k@j)*k@(a-1-h-i-j)
Fh,((a+1)//2){
  Fi,aI(2*h+i<a){o+:6*(k@h)*(k@i)*(k@(a-1-2*h-i))}
  I(a%2=1)o+:3*(k@h)*(k@((a-1-2*h)//2))
}
Fh,((a+2)//3)o+:8*(k@h)*(k@(a-1-3*h))
I(a%4=1)o+:6*k@(a//4)
o//:24

; Handle the remaining convolution,
; pulling out the special case which involves T_{-2}
Ia(o+:t@n@a)
Fh,nFj,(a+1)o-:(t@(h+1)@j-t@h@j)*(t@(h+1)@(a-j))

Note that this is my first ever Pip program, so is probably not very idiomatic.

380. Red, 255 bytes, A000180

Red [
    Title: "OEIS A000180"
    Author: "chunes"
]

factorial: function [n][
    product: 1
    repeat i n [
        product: product * i
    ]
    product
]

A000180: function [n][
    to-integer round 3 ** n * (factorial n) / exp 0.333333333333333
]

Try it online!

Next sequence!

379. Vyxal, 180 bytes, A000494

∆sṙ
##############
#####    #####
### LOOKS  ###
### LIKE   ###
### I HAVE ###
### TO     ###
### MAKE   ###
### THIS   ###
### 180    ###
### BYTES  ###
##############
   ########

Try it Online!

This is a very simple formula: \$ \large a(n) = \lfloor\sin(n)\rceil \$.

Next sequence!

378. Factor, 494 bytes, A000258

DEFER: stirling

: (stirling) ( n k -- x )
    [ [ 1 - ] bi@ stirling ]
    [ [ 1 - ] dip stirling ]
    [ nip * + ] 2tri ;

MEMO: stirling ( n k -- x )
    2dup { [ = ] [ nip 1 = ] } 2||
    [ 2drop 1 ] [ (stirling) ] if ;

: stirling2 ( n k -- m )
    2dup { [ = not ] [ nip zero? ] } 2&&
    [ 2drop 0 ] [ stirling ] if ;

: bell ( m -- n )
    [ 1 ] [ dup [1,b] [ stirling ] with map-sum ] if-zero ;

: A000258 ( n -- m )
    dup [0,b] [ [ stirling2 ] keep bell * ] with map-sum ; flushable

Attempt This Online!

Last Factor answer until 450 answers!

Next sequence!

377. Kitten, 258 bytes, A000235

define a000235 (Int32 -> Int32):
  0 0 0 0 1 a000235_tailrec

define a000235_tailrec (Int32, Int32, Int32, Int32, Int32, Int32 -> Int32):
  -> n, a, b, c, d, e;
  if (n = 0):
    b
  else:
    (n - 1) b c d e (a + b + -3 * c + -1 * d + 3 * e) a000235_tailrec

Next sequence!

Kitten is a statically typed concatenative language.

The formula for this sequence is \$a(0)=a(1)=a(2)=0\$, \$a(3)=1\$, \$a(n)=3a(n-1)-a(n-2)-3a(n-3)+a(n-4)+a(n-5)\$.

376. tinylisp, 235 bytes, A000231

(d 2pow (q ((count acc)
 (i count
  (2pow (s count 1) (a acc acc))
   acc))))

(d a000231 (q ((n)
 (a
  (2pow
   (s (2pow n 1) n)
   1)
  (s
   (2pow
    (2pow (s n 1) 1)
    1)
   (2pow
    (s
     (2pow (s n 1) 1)
     n)
    1))))))

Try it online!

Next sequence

We use the formula from the OEIS page, modified to not use multiplication or division:

$$2^{2^{x}-x}+2^{2^{x-1}}-2^{2^{x-1}-x}$$

Then, we implement \$2^n\$ by repeatedly doubling an accumulator.

375. Factor, 231 bytes, A001091

:: A001091 ( m -- n )
    [
        [let
            1 4 :> ( a! b! )
            m [
                b :> c
                b 8 * a - b!
                c a!
            ] times
            a
        ]
    ] 42 [ call ] dip drop ;

Try it online!

Really had to stretch this one to make it long enough from my initial draft of 42 bytes. It's silly, but not overly so, at least until the last line.

Next sequence!

374. Halfwit, 1091 bytes, A000907

n+:+R*;?>+<*>*<+*>b<>{<?>M<+e?>M<N+R*;**/NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN

Try It Online!

Next sequence

Issue is, I can't include any nice formatting because that isn't included within the codepage. So, I have to include a large amount of NOP Ns as padding. Uses the formula from the OEIS page.

373. Idris, 907 bytes, A000170

-- generate all possible col number lists
powerSet : Nat -> List (List Nat)
powerSet n = index n (iterate (liftA2 (::) (enumFromTo 1 n)) (Nil :: Nil))

-- symmetric difference
symDiff : Nat -> Nat -> Nat
symDiff Z m = m
symDiff (S n) Z = S n
symDiff (S n) (S m) = symDiff n m

-- given a pair of row and col numbers, unless the rows are equal (the same cell),
-- the cols and diagonals must not match
isOKPair : (Nat, Nat) -> (Nat, Nat) -> Bool
isOKPair (i1, n1) (i2, n2) = i1 == i2 || (n1 /= n2 && symDiff n1 n2 /= symDiff i1 i2)

-- attach row numbers to the list of col numbers
enumerate : List Nat -> List (Nat, Nat)
enumerate l = zip (enumFromTo 1 (length l)) l

-- is this board a valid N-Queen solution?
isNQueen : List Nat -> Bool
isNQueen l = all id (liftA2 isOKPair (enumerate l) (enumerate l))

-- count all N-Queen solutions
a000170 : Nat -> Nat
a000170 n = length (filter isNQueen (powerSet n))

Try it online!

Next sequence!

Another I-language into the mix. Idris (especially Idris 1 on TIO) is pretty much Haskell with dependent types and a bit stripped down library. Nat is a Peano natural number type, and all arithmetic functions on Nat are defined recursively by pattern-matching into Z and S n, which is demonstrated in the function symDiff. The other parts of the code just use various Prelude functions to complete the job.

372. Vyxal, 170 bytes, A000224

ɾ²$%UL

#       | | \ / \ /  _  |
#       \ /  |   X  /_\ |
#        v   |  / \ | | |__
#             
#   Terse, elegant and readable.
#   https://github.com/vyxal/vyxal

Try it Online!

Next Sequence!

My program's only six bytes, so I had to add some advertising :P

ɾ      # 1...n
 ²     # Squared
  $%   # Modulo n
    UL # Count unique

371. Factor, 224 bytes, A000490

:: A000364 ( n -- m )
    n [ 1 ] [
        -1 swap ^ neg n iota [| i |
            -1 i ^ i A000364 * 2 n * 2 i * nCk *
        ] map-sum *
    ] if-zero ; flushable
    
: A000490 ( n -- m )
    dup A000364 16 rot ^ * ; inline

Try it online!

Next sequence!

370. Swahili, 490 bytes, A000163

shughuli a000163(n) {
    wacha s = []
    kwa i = 0 mpaka n {
        s = s + 1
    }
    kwa i = 2 mpaka n {
        kwa j = 0 mpaka s/i {
            kwa k = i mpaka n {
                s.weka(k, s/k + s/(k-i))
            }
        }
    }
    wacha t = []
    kwa a katika s {
        t = t + 2 * a
    }
    kwa i = 0 mpaka 3 {
        kwa j = 1 mpaka n {
            kwa k = 0 mpaka j {
                t.weka(j, t/j + (t/k) * (s/(j-k)))
            }
        }
    }
    rudisha t
}

Next sequence!

Swahili is a programming language in Swahili.

369. Add++, 163 bytes, A001015

;you know what is this
`y
;activate y
?^7
;active = ARG to the power of 7
`x
;activate x
oy
;output x!
y:0
;x is 0, why active?
;[X]HTML can't be parsed with regex

Next sequence!

Try it online!

351. Quipu, 178 bytes, A000166

" 0  1  2  3  4"
"--------------"
 \/ 1& 2& 1& 3&
 1& ++ ^^ ++ []
 ++ 0& -- 1& 1&
    []    [] ++
    %%    ** /\
    4&    2&
    ==    []
          --
          1&
          ??

Attempt This Online!

Next sequence!

Based on Aaroneous Miller's factorial answer.

Here is a golfed version.

367. Acc!!, 187 bytes, A000202

N
Count i while _%60/48 {
  _/60*10 + _%60-48
  _*60 + N
}
_/60

_/8 * 13 + (_%8+1) * 8/5

Count d while _/10^d {
  Count i while 9/(_/10^d) * (d+1-i) {
    Write _/10^(d-i)%10 + 48
  }
}

Try it online!

Next sequence!

Explanation

The top and bottom sections are merely code for inputting and outputting a decimal integer, respectively. The line by itself in the middle is what computes the sequence. Observe that i in the OEIS definition is the same as the zero-based index integer-divided by 8, while j (adjusted for zero-indexing) is the remainder of that division, i.e. the index mod 8. After some trial and error, we discover that we can map j to the numbers 1, 3, 4, 6, 8, 9, 11, 12 by a simple linear function.

_                   # The sequence index
 /8                 # int-divided by 8 (i)
   *13              # times 13
      +             # Plus
        _%8         # the index mod 8 (j)
       (   +1)      # plus 1
              *8    # times 8
                /5  # int-divided by 5

365. Sass, 207, A002534

@function a002534($n) {
    @if $n < 0 {
        @return -1;
    }
    @if $n == 0 {
        @return 0;
    }
    @if $n == 1 {
        @return 1;
    }
    @return 2*a002534($n - 1) + 9 * a002534($n - 2);
}

Next sequence!

Try it here:

let sassCode = "@function a002534($n) {\n" +
"    @if $n < 0 {\n" +
"        @return -1;\n" +
"    }\n" +
"    @if $n == 0 {\n" +
"        @return 0;\n" +
"    }\n" +
"    @if $n == 1 {\n" +
"        @return 1;\n" +
"    }\n" +
"    @return 2*a002534($n - 1) + 9 * a002534($n - 2);\n" +
"}";

function sassFunctionCallCode(n) {
  return '.answer::after { content: "" + a002534(' + n + '), }'
}

const styleElement = document.createElement('style');
document.head.append(styleElement);


document.getElementById('compile').onclick = function() {
  const result = Sass.compile(sassCode + sassFunctionCallCode(document.getElementById('input').value), function(result){
    styleElement.textContent = result.text;
  });
}

document.getElementById('length').textContent = "The Sass code has length " + sassCode.length + ".";
<script src="https://cdnjs.cloudflare.com/ajax/libs/sass.js/0.9.12/sass.sync.min.js"></script>

<input id="input" type="number" value="4" />
<button id="compile">Compile</button>

<div class="answer">The answer is:&nbsp;</div>

<div id="length"></div>

364. Wenyan (文言), 2534 bytes, A001669

吾有一術。名之曰「開方本源圖」。欲行是術。必先得一數。曰「甲」。乃行是術曰。
 批曰。「「西人謂之曰「巴斯噶三角」者是也。」」
 吾有一列。名之曰「層」。充「層」以一。
 為是「甲」遍。
  吾有一列。名之曰「下層」。
  吾有一數。曰零。名之曰「上廉」。
  凡「層」中之「廉」。
   加「廉」以「上廉」。名之曰「下廉」。充「下層」以「下廉」。
   昔之「上廉」者。今「廉」是矣。
  云云。
  充「下層」以一。
  昔之「層」者。今「下層」是矣。
 云云。
 乃得「層」。
是謂「開方本源圖」之術也。

吾有一術。名之曰「指數」。欲行是術。必先得一列。曰「天」。乃行是術曰。
 批曰。「「形式冪級數之指數者也。不計其常數項。」」
 夫「天」之長。名之曰「階」。
 吾有一列。名之曰「地」。
 吾有一數。曰零。名之曰「甲」。
 為是「階」遍。
  若「甲」等於零者。
   充「地」以一。
  若非。
   減「甲」以一。施「開方本源圖」於其。名之曰「開方本源」。
   吾有一數。曰零。名之曰「乙」。
   吾有一數。曰零。名之曰「和」。
   凡「開方本源」中之「廉」。
    減「甲」以「乙」。加其以一。名之曰「丙」。
    加一於「乙」。昔之「乙」者。今其是矣。
    夫「地」之「乙」。名之曰「項」。
    夫「天」之「丙」。乘其以「項」。乘其以「廉」。
    加其於「和」。昔之「和」者。今其是矣。
   云云。
   充「地」以「和」。
  云云。
  加一於「甲」。昔之「甲」者。今其是矣。
 云云。
 乃得「地」。
是謂「指數」之術也。

吾有一術。名之曰「序列零零壹陸陸玖」。欲行是術。必先得一數。曰「甲」。乃行是術曰。
 批曰。「「OEIS之序列A001669者是也。」」
 加一於「甲」。昔之「甲」者。今其是矣。
 吾有一列。名之曰「天」。為是「甲」遍。充「天」以一也。
 為是六遍。
  施「指數」於「天」。昔之「天」者。今其是矣。
 云云。
 夫「天」之「甲」。名之曰「乙」。
 乃得「乙」。
是謂「序列零零壹陸陸玖」之術也。

Next sequence!

Time to write some Classical Chinese.

You can try it on this Online IDE. Add the following snippets to the end to print the first 20 terms. Uncheck "Print Hanzi" in the settings to show the results in Arabic numerals.

吾有一數。曰零。名之曰「甲」。
為是二十遍。
 施「序列零零壹陸陸玖」於「甲」。書之。
 加一於「甲」。昔之「甲」者。今其是矣。
云云。

363. Iota, 1669 bytes, A000324

***i*i*i*ii***i*i*i*ii***i*i*i*ii***i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii**i*i*ii**i*i*ii**i*i*i*ii*i*i*ii**i*i*ii*i*i*ii**i*i*i*ii*i*i*ii***i*i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii**i*i*i*ii*i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii*i*i*ii*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii**i*i*i*ii*i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii*i*i*ii*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii**i*i*i*ii*i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii*i*i*ii*i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii*i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii**i*i*ii***i*i*i*ii**i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii**i*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii*i*i*ii*i*i*ii**i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii***i*i*i*ii**i*i*ii*i*i*i*ii*i*i*ii***i*i*i*ii*i*i*ii*i*i*ii

Next sequence!

This is a pure lambda calculus function that, given n (0-indexed) as a Church numeral, computes the n-th term of A000324 as another Church numeral. (Also works as a function in Lazy K, which is just a union of multiple minimalist lambda calculus-related languages.)

I don't know of any online system that can test this function directly, but you can test a human-readable version of this program on Ben Lynn's online SK compiler:

true = \x y -> x
false = \x y -> y
is0 = \n -> n (\x -> false) true
n0 = \f x -> x
n1 = \f -> f
n2 = \f x -> f (f x)
n5 = \f x -> f (f (f (f (f x))))
pred = \n f x -> n (\g h -> h (g f)) (\u -> x) (\u -> u)
seq = \x -> is0 x n1 (pred x (\y -> n2 (pred (pred y))) n5)
n3 = \f x -> f (f (f x))
n4 = \f x -> f (f (f (f x)))
main = seq n0  -- try giving n1, n2, n3 instead

The SK compiler's output (without the number argument) was then fed into this Python program to yield the corresponding Iota code.

362. Pyramid Scheme, 324 bytes, A000272

    ^           ^
   / \         /?\
  /set\       ^---^
 ^-----^     /!\ / \
/n\   /#\   ^---/out\
---  ^---  /?\  -----^
    / \   ^---^     /0\
   /   \ /n\ / \    ---
  /line \---/out\
  -------  ^-----
          /^\
         ^---^
        /n\ / \
        ---/ - \
          ^-----^
         /n\   /2\
         ---   ---

Try it online!

Next sequence!

361. Excel (Insider Beta), 272 bytes, A000215

Define name times2 as a LAMBDA function, 224 bytes

times2=LAMBDA(x,y,
 IF(y=0,
    x,
    LET(a,SEQUENCE(LEN(x)),
        b,MID(x,a,1)*2,
        times2(
          CONCAT(IF(INDEX(b,1)>9,1,""),
                 RIGHT(b)+IF(a=LEN(x),0,INT(INDEX(b,a+1)/10))),
          y-1))))

Cell A2, 15 bytes

=times2(1,2^A1)

Cell A3, 33 bytes

=LEFT(A2,LEN(A2)-1)&(RIGHT(A2)+1)

Link to Spreadsheet

Next Sequence

360. Zephyr, 215 bytes, A000169

`#-
    OEIS  A000169
    Number of labeled rooted trees with n nodes: n^(n-1).
-#`

input num as Integer

set res to 1
set cnt to 1

while cnt < num
    set cnt to cnt + 1
    set res to res * num
repeat

print res

Try it online!

Next sequence!

Interestingly, this is the first language here that starts with Z.

359. MOO, 169 bytes, A000304

number = args[1];
if (number < 4)
  return number;
else
  firstnum = this:(verb)(number - 1);
  secondnum = this:(verb)(number - 2);
  return firstnum * secondnum;
endif

It's getting kind of annoying that all of the short bytecounts are used up, and you have to deliberately bowl to make an answer for the easy sequences. I tried to make it not look obviously bloated, and think I did a good job.

Similar to the previous answer, this sequence grows very fast and the code can only handle up to A(9) before integer overflow occurs.

There's been some rumbling about making the programming language support 64-bit-integers, but nothing's happened yet.

In case anyone cares, return (n=args[1])<4?n|this:(v=verb)(n-1)*this:(v)(n-2); is a 56-byte golfed version (although it could probably be golfed even further if I spent more than a few minutes on it).

Next sequence

Interestingly, the next sequence also grows very fast.

358. CoffeeScript 2, 304 bytes, A000167

# BesselK satisfies the following recurrence relation: 
# BesselK(n + 1, x) = BesselK(n - 1, x) + n * BesselK(n, x)

b = [0.11389387274953344, 0.13986588181652243]

besselk2 = (n) ->
  while b.length <= n
    i = b.length - 1
    b.push(b[i - 1] + i * b[i])
  b[n]

a000167 = (n) -> Math.round besselk2 n

Try it online!

Next sequence!

This sequence grows very fast. Only the first 20 outputs are accurate. But CoffeeScript doesn't have an Integer type anyway. Its number type is 64-bit floating-points. So I think some inaccuracy is allowed.

357. Julia 1.0, 167 bytes, A000703

function A000703(n)
    N = 24n
    for i in Iterators.countfrom(5)
        a = 2i
        a -= 7
        a *= a
        a -= 1
        a > N && return i-1
    end
end

Try it online!

the reference implementation was floor((7+sqrt(1+24*n))/2), which is a bit too easy and not enough characters, so I only used simple operators (*, -, >)

Next sequence if mathematica can compute besselk, hopefully anyone can

356. ArnoldC, 703 bytes, A000244

IT'S SHOWTIME
HEY CHRISTMAS TREE loop
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE i
YOU SET US UP @I LIED
HEY CHRISTMAS TREE x
YOU SET US UP 1
HEY CHRISTMAS TREE p
YOU SET US UP @NO PROBLEMO
GET YOUR ASS TO MARS p
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY
GET TO THE CHOPPER loop
HERE IS MY INVITATION p
LET OFF SOME STEAM BENNET i
ENOUGH TALK
STICK AROUND loop
 GET TO THE CHOPPER i
 HERE IS MY INVITATION i
 GET UP 1
 ENOUGH TALK
 GET TO THE CHOPPER x
 HERE IS MY INVITATION x
 YOU'RE FIRED 3
 ENOUGH TALK
 GET TO THE CHOPPER loop
 HERE IS MY INVITATION p
 LET OFF SOME STEAM BENNET i
 ENOUGH TALK
CHILL
TALK TO THE HAND x
YOU HAVE BEEN TERMINATED

Try it online!

Next Sequence

86. Gaia, 40 bytes, A000097

1w×ḍΣ¦¦ȯ¦u⟨:l0₁,*¤⟪¤;3<×\?⟫†¦ȯ¦u⟩¦e¦l:!+

Next sequence

355. Pyret, 244 bytes, A000195

fun a000195(n :: NumNonNegative) -> NumInteger:
  num-floor(num-log(n))
where:
  a000195(1) is 0
  a000195(2) is 0
  a000195(3) is 1
  a000195(4) is 1
  a000195(5) is 1
  a000195(6) is 1
  a000195(7) is 1
  a000195(8) is 2
  a000195(9) is 2
end

Next sequence!

Try it online!

One interesting feature of this language is that you can add unit tests to functions using the where clause.

354. 05AB1E (legacy), 195 bytes, A000260

4*>DI>csI<c9*-1MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

Although 05AB1E is banned currently, the legacy version nor 2sable aren't, which are predecessors. 2sable and the legacy version both use a Python backend and the latest 05AB1E uses an Elixir backend. Some of the builtins are also fairly different between the three versions, although this program would act the same in the new and legacy versions of 05AB1E (it fails in 2sable, though).

Try it online or verify the first [0,20] test cases.

Next sequence: A000195. (I just picked a fairly easy one.)

Explanation:

I use the following formula to implement A000260:

$$a(n)=\binom{4n+1}{n+1} - 9\times\binom{4n+1}{n-1}$$

4*          # Multiply the (implicit) input-integer by 4
  >         # Increase it by 1
   D        # Duplicate it
    I>      # Push the input+1
      c     # Binomial coefficient of input*4+1 and input+1
   s        # Swap so the duplicated input*4+1 is at the top again
    I<      # Push the input-1
      c     # Binomial coefficient of input*4+1 and input-1 as well
       9*   # Multiply this by 9
         -  # And subtract it from the earlier number
            # (this is the correct result, except for a(0)=-8)
1           # Push a 1 to the stack
 M          # Push a copy of the largest value on the stack
            # (implicitly output the top of the stack as result)

The additional M do the same, so are essentially no-ops.

353. Tampio (imperative), 260 bytes, A000197

Pienen Luvun kertoma on
  riippuen siitä, onko se pienempi tai yhtä suuri kuin yksi,
  joko yksi
  tai pieni luku kerrottuna pienen luvun edeltäjän kertomalla.

Luvun edeltäjä on se vähennettynä yhdellä.

Luvun kaksoiskertoma on sen kertoman kertoma.

Next sequence!

Try it online!

Yes, a Finnish programming language, even though I don't speak that language.

Thanks @fergusq for making this awesome language, and writing a detailed introduction.

The code above compiles to the following JavaScript code:

Number.prototype.f_kertoma = function() {
 var pieni_luku = this;
 return ((this<=(1)) ? ((1)) : ((pieni_luku*pieni_luku.f_edeltäjä().f_kertoma())));
};
Number.prototype.f_edeltäjä = function() {
 return (this-(1));
};
Number.prototype.f_kaksoiskertoma = function() {
 return this.f_kertoma().f_kertoma();
};

The first two functions, kertoma (factorial) and edeltäjä (predecessor), are directly taken from fergusq's factorial example in the introduction.

The sequence is defined in the third function: kaksoiskertoma. Since I don't speak Finnish, I can't find a suitable name. Kaksoiskertoma actually means the double factorial (\$n!!=n*(n-2)*(n-4)*\cdots\$), while A000197 is literally applying the factorial function twice.

352. MathGolf, 197 bytes, A000178

╤!ε*

"
╤     # Push a list in the range [-n,n]
 !    # Get the factorial of each, where the negative numbers become 1
  ε*  # Reduce the list by multiplying (a.k.a. take the product of the list)";

Try it online.

Next sequence: A000197.

Explanation:

A000178 is the formula: \$a(n) = \prod_{i=0}^ni!\$

I've already put the explanation in the program itself, wrapped in a string which we discard with ; (after which MathGolf outputs the entire stack joined together as result). The additional newlines for readability are no-ops.

The next sequence A000197 is coincidentally also related to factorials: \$a(n)=(n!)!\$

344. Proton, 301 bytes, A000382

p = a => {
	if len(a) == 1 return [a]
	values = []
	for i : 0 .. len(a)
		for j : p(a[to i] + a[i + 1 to])
			values.append([a[i]] + j)
	return values
}

a = n => {
	total = 0
	n += 4
	for j : p(0 .. n)
		if all((j[i] - i) % n < 4 for i : 0 .. n)
			total++
	return total
}

print(a(int(input())) / 4)

Try it online!

Next sequence.

This code takes a long time on n = 2 and I don't want to try testing it on larger cases :P In theory, it works for all cases; the code is an exact implementation of the sequence description, so no fancy math stuff that could break.

Inefficient Coding 101 with hyper-neutrino \o/

(this is intentionally posted from my bot account. someone downvoted one of my posts and now I only have 19 reputation, which isn't enough to chat. and also I'm not going to go upvote it with my main account because that's evil, so I'm making a new post to earn some reputation, hopefully)

350. Husk, 166 bytes, A000774

*Π¹→ṁ\ḣ
" Explanation
"
" *Π¹→ṁ\ḣ
"    →      1 plus
"     ṁ\     sum of reciprocals of
"       ḣ     the range [1..N]
" *        times
"  Π¹       the factorial of N

Try it online!

Next sequence!

It was surprisingly tricky to get the explanation to come out to the correct length.

349. Kotlin, 774 bytes, A000607

val primes = mutableListOf<Int>   (2)
val prev   = mutableListOf<Double>(1.0)
fun sequence(n: Int): Double {
    if (n < prev.size)
        return prev.get(n)
    var sum = 0.0
    for (k in (primes.last() + 1)..n) {
        var prime = true
        for (p in primes)
            if (k % p == 0) {
                prime = false
                break
            }
        if (prime)
            primes.add(k)
    }
    for (k in 1..n) {
        var divsum = 0
        for (p in primes) {
            if (p > k)
                break
            if (k % p == 0)
                divsum += p
        }
        sum += divsum * sequence(n - k)
    }
    val res = 1.0 / n * sum
    prev.add(res)
    return res
}
fun main() {
    println(sequence(readLine()!!.toInt()).toInt())
}

Try it online!

Next sequence!

Nothing special here other than caching values because of the immense amount of recursion. (Side note -- this is my first Kotlin program!)

348. Rust, 607 bytes, A000824

use num_bigint::BigUint;
use std::io::*;
fn main()->Result<()>{
    let mut stdin = stdin();
    let mut s = String::new();
    stdin.read_to_string(&mut s)?;
    let n=s.parse().unwrap()+1;
    println!("{}", a(n));
    Ok(())
}
fn a(n:u32)->BigUint{
    let part_a = helper(3,3,n);
    let part_b = helper(2,3,n) * 3u32;
    let part_c = helper(1,1,n) << 1;
    (part_a + part_b +part_c)/6u32
}
fn helper(r:u32,s:u32,n:u32)->BigUint{
    let one:BigUint = 1u32.into();
    let part_a = &one << (r << n); 
    let part_b = ((&one << n) - &one) * (&one << (s * (1 << (n - 1))));
    (part_a + part_b) >> n
}

Try it on the Rust Playground!

Next Sequence

I used the num_bigint crate to get arbitrary precision integers. Since the rust playground doesn't support stdin I created a drop-in replacement method- simply change the number in-between the 2 quotation marks to change the input. The code can make it up to a(18), which has 473,473 digits, before it times out if you do a release build. The sequence is calculated based on the formula found on the OEIS (after adjusting to a 1-index and using bitshifts for the \$2^n\$s):

$$\text{Let } b_n(r,s) = \frac{2^{r\cdot2^n} + (2^n-1)\cdot2^{s\cdot2^{n-1}}}{2^n} \\ \text{Then, } a(n) = \frac{b_n(3,3) + 3b_n(2,3) + 2b_n(1,1)}{6}$$

347. Pure, 824 bytes, A003780

using system;
arr = [0L,0L,0L,0L,0L,296L,0L,0L,0L,70420L,0L,0L,0L,16391166L,0L,0L,0L,3816021084L,0L,0L,0L,888375830566L,0L,0L,0L,206814474641944L,0L,0L,0L,48146529005876746L,0L,0L,0L,11208539472498838244L,0L,0L,0L,2609354391828066201746L,0L,0L,0L,607459192887167645884388L,0L,0L,0L,141416847085185500394182672L,0L,0L,0L,32921922778799648796216249818L,0L,0L,0L,7664242427921761934124201980862L,0L,0L,0L,1784240015038927382237215443432910L];
A003780 n = 262 * A003780(n-4) - 7125 * A003780(n-8) + 78668 * A003780(n-12) - 581608 * A003780(n-16) + 2138065 * A003780(n-20) - 5215246 * A003780(n-24) + 16969316 * A003780(n-28) - 43146455 * A003780(n-32) + 39514076 * A003780(n-36) + 7628882 * A003780(n-40) - 6116529 * A003780(n-44) + 23336 * A003780(n-48) - 2876 * A003780(n-52) + 64 * A003780(n-56) if n > 57;
= arr!n otherwise;

Try it online!

This code assumes the recursion given in OEIS is correct.

This is the first time I use pure, so I hope I didn't do anything wrong.

Next sequence.

1. Triangular, 10 bytes, A000217

$\:_%i/2*<

Try it online!

Next Sequence

How it works

The code formats into this triangle

   $
  \ :
 _ % i
/ 2 * <

with the IP starting at the $ and moving South East (SE), works like this:

$            Take a numerical input (n);     STACK = [n]
 :           Duplicate it;                   STACK = [n, n]
  i          Increment the ToS;              STACK = [n, n+1]
   <         Set IP to W;                    STACK = [n, n+1]
    *        Multiply ToS and 2ndTos;        STACK = [n(n+1)]
     2       Push 2;                         STACK = [n(n+1), 2]
      /      Set IP to NE;                   STACK = [n(n+1), 2]
       _     Divide ToS by 2ndToS;           STACK = [n(n+1)/2]
        \    Set IP to SE;                   STACK = [n(n+1)/2]
         %   Output ToS as number;           STACK = [n(n+1)/2]
          *  Multiply ToS by 2ndToS (no op); STACK = [n(n+1)/2]

15. CJam, 85 bytes, A000060

{ee\f{\~\0a*@+f*}:.+}:C;2,qi:Q,2f+{_ee1>{~2*\,:!X*X<a*~}%{CX<}*W=+}fX_0a*1$_C.- .+Q)=

Online demo

Next sequence

Dissection

OEIS gives

G.f.: S(x)+S(x^2)-S(x)^2, where S(x) is the generating function for A000151. - Pab Ter, Oct 12 2005

where

$$\begin{eqnarray*}S(x) & = & x \prod_{i \ge 1} \frac{1}{(1 - x^i)^{2s(i)}} \\ & = & x \prod_{i \ge 1} (1 + x^i + x^{2i} + \ldots)^{2s(i)}\end{eqnarray*}$$

{           e# Define a block to convolve two sequences (multiply two polynomials)
  ee\f{     e#   Index one and use the other as an extra parameter for a map
    \~\0a*  e#     Stack manipulations; create a sequence of `index` 0s
    @+f*    e#     Shift the extra parameter poly and multiply by the coefficient
  }
  :.+       e#   Fold pointwise add to sum the polys
}:C;        e# Assign the block to C (for "convolve")
2,          e# Initial values of S: S(0) = 0, S(1) = 1
qi:Q        e# Read integer and assign it to Q
,2f+{       e# For X = 2 to Q+1
  _ee1>     e#   Duplicate accumulator of S, index, and ditch 0th term
  {         e#   Map (over notional variable i)
    ~2*\    e#     Double S(i) and flip i to top of stack
    ,:!     e#     Create an array with a 1 and i-1 0s
    X*X<    e#     Replicate X times and truncate to X values
            e#     This gives g.f. 1/(1-x^i) to the first X terms
    a*~     e#     Create 2S(i) copies of this polynomial
  }%
  {CX<}*    e#   Fold convolution and truncation to X terms
  W=+       e#   Append the final coefficient, which is S(X), to the accumulator
}fX
_0a*        e# Pad a copy to get S(X^2)
1$_C        e# Convolve two copies to get S(X)^2
.-          e# Pointwise subtraction
 .+         e# Pointwise addition. Note the leading space because the parser thinks
            e# -. is an invalid number
Q)=         e# Take the term at index Q+1 (where the +1 adjusts for OEIS offset)

89. PowerShell, 201 bytes, A000386

function f($m){if($m -lt 1){return 1};1..$m|%{$a=[bigint]1}{$a*=$_}{$a}}
function A000386($n){if($n -le 2){return 0}3..$n|%{$b=[bigint]0}{$b=(f($_-3))*(f($n+$_-3))/(f($n-$_))/(f(2*$_-6))/(f 3)-$b}{$b}}

Online test suite

Next Sequence

Dissection

Pretty straightforward: the sequence has the formula

$$A(n) = \sum_{j=3}^n (-1)^{n-j} (j-3)! \binom{n+j-3}{n-j,2j-6,3}$$

obtained via some algebraic manipulation from the description in A058057. There are a couple of tricky bits:

x..y

produces a range from x to y, but it counts down if y < x, which is not what I want. That's why both functions have special cases.

x..y|%{foo}{bar}{baz}

is an abbreviated foreach loop. In more familiar pseudocode it might be

foo
for $_ = x to y
  bar
baz

346. C++14 (gcc), 3780 bytes, A000162

// oeis

#ifndef _GLIBCXX_DEBUG
#define NDEBUG
#endif
#include <cassert>

#include<iostream>
#include<vector>
#include<algorithm>

using v1=std::vector<char>;
using v2=std::vector<v1>;
using v3=std::vector<v2>;

template<class Ar>Ar zip(Ar const& a){
	Ar result(a[0].size());
	for(size_t y=a[0].size();y-->0;){
		result[y].resize(a.size());
		for(size_t x=a.size();x-->0;)
			result[y][x]=a[x][y];
	} return result;
}

template<class Ar>Ar rot1(Ar a){ // rotate cw, assume
	// row-major, row counts down, columns count right
	std::reverse(a.begin(),a.end());
	return zip(a);
}
template<class Ar>Ar rot2(Ar a){ // reverse of rot1
	a=zip(a);std::reverse(a.begin(),a.end());
	return a;
}

template<class Fn>auto each(Fn f){//f must have type (T -> T)
	return [f](auto&& ar){
		for(auto& elem:ar)elem=f(std::move(elem));
		return ar;
	};
}
auto zipeach=each(zip<v2>);

template<class Fn>auto twice(Fn f){//f must have type (T -> T)
	return [f](auto&& ar){
		return f(f(std::forward<decltype(ar)>(ar)));
	};
}

template<class Ar>std::vector<Ar>allrot2(Ar a,std::vector<Ar>& result){
	// calculate all (4) rot of the 2D array (a) and append to (result).
	result.push_back(std::move(a));
	for(int i=3;i-->0;)result.push_back(rot1(result.back()));
	return result;
}
auto rot1each=each(rot1<v2>);

std::vector<v3>allrot(v3 a){
	std::vector<v3>result;
	for(int i=0;i<4;++i){
		/*
		auto r2a=allrot2(a);
		result.insert(result.end(),
			std::make_move_iterator(r2a.begin()),
			std::make_move_iterator(r2a.end()));
		*/
		allrot2(a,result);
		a=rot1each(a);
	}
	a=zipeach(rot1(zipeach(a)));
	allrot2(a,result);
	a=each(twice(rot1<v2>))(a);
	allrot2(a,result);
	return result;
}

void pr(v3 const&a){
	for(v2 const&plane:a){
		for(v1 const&row:plane){
			for(int x:row)std::cout<<x;
			std::cout<<'\n';
		} std::cout<<'\n';
	} std::cout<<"=======\n";
}

// given a v2, return something with its size but all zeroes.
v2 zero(v2 x){x.assign(x.size(),v1(x[0].size())); return x;}
v3 pad (v3 x){// pad left and right with an all-zero v2.
	x.insert(x.begin(),zero(x[0]));//at begin
	x.push_back(x[0]);//at end-now begin is a zero()
	return x;}
v3 trim(v3 x){//the array (x) must not be completely empty
	auto it=x.begin();auto p0=zero(x[0]);
	while(p0==*it)++it;
	x.erase(x.begin(),it);
	while(x.back()==p0)x.pop_back();
	return x;
}

template<class Fn,Fn f>v3 ap3d(v3 a){ // apply for all 3 dimensions
	a=f(a); // x y z -> [x] y z
	a=zipeach(a); // [x] z y
	a=zip(f(zip(a))); // [x] [z] y
	a=zipeach(a); // [x] y [z]
	a=zip(f(zip(a))); // [x] [y] [z]
	return a;
}
auto pad3d =ap3d<decltype(&pad),&pad>;
auto trim3d=ap3d<decltype(&trim),&trim>;

std::vector<v3> expand(std::vector<v3> cubes){
	std::vector<v3> result;
	for(v3&cube:cubes){
		cube = pad3d(std::move(cube));
		size_t const nx=cube.size(),ny=cube[0].size(),nz=cube[0][0].size();
		for(size_t x=nx;x-->0;)
		for(size_t y=ny;y-->0;)
		for(size_t z=nz;z-->0;){
			if(cube[x][y][z])continue;
			if(
				(x&&cube[x-1][y][z])||(x!=nx-1&&cube[x+1][y][z])||
				(y&&cube[x][y-1][z])||(y!=ny-1&&cube[x][y+1][z])||
				(z&&cube[x][y][z-1])||(z!=nz-1&&cube[x][y][z+1])
			){
				result.push_back(cube);
				result.back()[x][y][z]=true;
				result.back()=trim3d(std::move(result.back()));
			}
		}
	}
	return result;
}

int main() {
	std::vector<v3> a={{{{1}}}};
	int n;std::cin>>n;
	++n;//1-based indexing ==> 0-based indexing
	--n;while(n-->0){
		a=expand(a);
		std::sort(a.begin(),a.end());
		a.erase(std::unique(a.begin(),a.end()),a.end());
	}
	long long ans=0;size_t constexpr NCUBEROT=24;
	for(auto&cube:a){
		assert(!cube.empty());
		auto rots=allrot(std::move(cube));
		assert(rots.size()==NCUBEROT);
		++ans;//i==0
		for(size_t i=1;i<NCUBEROT;++i)
			ans+=rots[0]==rots[i];
	}
	assert(ans%NCUBEROT==0);
	std::cout<<ans/NCUBEROT<<'\n';
}

Try it online!

Next sequence. I didn't check what it is, but hopefully easy.

345. brainfuck, 162 bytes, A000301

+<<,[>>[>]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[>+>+<<-]>>[<<+>>-]<[<]<-]>>[>]+<[-]++<[>[>>+>+<<<-]>>>[<<<+>>>-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>[-]>[<<+>>-]<<<<-]>>too golfy.

Try it online!

Next sequence!

This takes as input the character with code point n (by BF's specs) and outputs in the same way. To see the numbers, I suggest using @Timwi's EsotericIDE.

Explanation:

+<<,                                  Initialize the tape with the first two Fibonacci numbers. Take loop counter from input.
[                                     n times:
  >>[>]                                 Move to the end of the tape. 
  <<[>>+>+<<<-]>>>[<<<+>>>-]            Add fib(n-2)...
  <<[>+>+<<-]>>[<<+>>-]                 and fib(n-1). Store on the end of the tape.
  <[<]<-                                Move back to start of tape. Update loop counter.
]                                     End loop.
>>[>]+<[-]++<                         Delete the extra Fibonacci number and prepare for exponentiation. 
[                                     fib(n) times:
  >[>>+>+<<<-]>>>[<<<+>>>-]<<           Copy the base (2) to preserve it.
  [>[>+>+<<-]>>[<<+>>-]<<<-]            Multiply what started as a 1 by the base.
  >[-]>[<<+>>-]<<<<-                    Clean up and update loop counter.
]                                     End loop.
>>too golfy.                          Add some bytes, for all sequences <162 had been used. Print result. 

Since this stores all Fibonacci numbers up to the important one, it will fail for REALLY big input on a bounded tape.

This could be shortened significantly by hardcoding the base (2), but golfiness isn't an issue at all.

343. Hodor, 382 bytes, A000164

HoDoRHoDoR hodor?!? 000164(HODOR? ) {
  $HODOR: HODOR = 0;
  HODOR{} (o=0; o<=HODOR? ; o++) {
    HODOR{} (d=0; d<=o; d++) {
      HODOR{} (r=0; r<=d; r++) {
        if(HODOR... HODOR hodor. h.HODOR. oHODOR!? (o,2)+HODOR... HODOR hodor. h.HODOR. oHODOR!? (d,2)+HODOR... HODOR hodor. h.HODOR. oHODOR!? (r,2)==HODOR? ) {
          HODOR +=1;    }
      }
    }
  }
  HODOR:: HODOR ;
}

Hodor!

Hodor.

342. 05AB1E, 164 bytes, A000803

2‹i0,q}3‹i8,q}0 0 8)I2-FDO4-¸«¦D}θ,                                                                                                                                 

Try it online!

Next sequence: A000164 - Partition of squares again

129 spaces padded after the last command.

341. Physica, 803 bytes, A000206

Func Divisors(number: int) – list:
    Return Filter[->divisor: number % divisor == 0; Range[1; number]]

Func GCD(a: int; b: int) – int:
    Return Element[Filter[->number: a % number == b % number == 0; Range[1;Min[{a; b}]]]; 0]

Func EulerPhi(number: int) – int:
    Return Length @ Filter[->a: GCD(a; number) == 1; Range[1; number]]

Func A000013(number: int) – int:
    Return Sum[Map[-> d: (EulerPhi[2 * d] * 2 ^ (number / d)) / (2 * number); Divisors[number]]]

Func A000011(number: int) – int:
    Return (A000013(number) + 2 ^ (number / 2)) / 2


Func A000206(number: int) – int:
    If number == 0:
        Return 1
    If number % 2 == 1:
        Return A000011(2*number) / 2
    Else:
        Return (A000011(2*number) + A000011(number) + 4^(number/2 - 1) - 2^(number/2 - 1)) / 2

Next Sequence.

Demo

As Physica is not available on TIO yet, here's a GIF:

Usage GIF

How it works?

OEIS states that this is equivalent to the even orbits of binary necklaces of length 2n under Dn x Sn, and so its formula is a(n) = (A000011(2n) + A000011(n) + 4n/2-1 - 2n/2-1) / 2 for even values of n and a(n) = A000011(2n) / 2 if n is odd, with n for non-null values of n, with a(0) = 1. Diving a bit deeper in OEIS, we find that A000011(n)=(A000013(n)+2⌊n / 2⌋) / 2. Using the formula for A000013, the closed-form of A000011 becomes:

     A000011 closed form

Hence the sequence I implement becomes:

     A000206 – odd n

When n ≡ 1 (mod 2), else:

A000206 – even n

340. x86_64 assembly (nasm), 206 bytes, A000209

extern printf
section .data
fmt: db "%d", 10, 0
section .text
global f
f:
    push rdi
    fild qword [rsp]
    fptan
    fstp st0
    fistp qword [rsp]
    pop rsi
    lea rdi, [rel fmt]
    mov rax, 0
    call printf wrt ..plt
    ret

Try it online!

Next Sequence

The only reason I'm printing instead of returning the result is that I needed to get a higher byte count.

To test save the code below in a206.asm and run

$ nasm -f elf64 a206.asm
$ gcc a206.o -o a206
$ ./a206 11
-226

Test code:

extern printf
section .data
fmt: db "%d", 10, 0
section .text
global f
f:
    push rdi
    fild qword [rsp]
    fptan
    fstp st0
    fistp qword [rsp]
    pop rsi
    lea rdi, [rel fmt]
    mov rax, 0
    call printf wrt ..plt
    ret

extern atoi
global main
main:
    mov rdi, [rsi+8]
    call atoi wrt ..plt

    mov rdi, rax
    call f

    mov rax, 0
    ret

339. ><>, 209 bytes, A000287

0i:0)?!va{*$"0"-+00.
:{6401~<vv?(6
vv?)4:-5<>0n; v<v<v<
> 1-}r>:?v~n; @+*}@+
&&    ~  1    :@@:@4
~5    ^$-<    !^<^<*
>>:32,*3!1-@@:}*@:8^
!v+3*2:@+@@*}<>f2,*v
?>@@:}*@@+$:v^:@@+6<
 v@{@{$,@$+4<
^>{@{@1+:&:&)

Try it online!

Next Sequence

This is the chain's third answer in ><>, meaning it can't be used again until we hit answer #450.

The next sequence should be pretty easy if you use a language with trig and rounding built in.

338. Triangularity, 287 bytes, A000154

...........)...........
..........1)1..........
.........)2)7).........
........35)228)........
.......1834)1738.......
......2)195866)24......
.....87832)3549957.....
....6)562356672)979....
...4156448)186025364...
..016)3826961710272)8..
.4775065603888)2011929.
826983504W)IEsm........

Try it online!

Next Sequence

The previous sequence is erroneous, so hardcoding the terms listed in OEIS should be allowed as far as I am aware.

337. Mathematica 11 (Wolfram Language), 154 bytes, A000159

A000159[n_] := CoefficientList[ Sum[ 2 * (n+3) / (2 * (n+3)-k) * (2 * (n+3)-k)! / (k! * (2 * (n+3)-2 * k)!) * (n+3-k)! * (x-1)^k , {k,0,n + 3}] ,x] [[4]];

Try it online!

Next Sequence

335. Python 2 (Cython), 620 bytes, A000157

from itertools import*
from math import*
from functools import*
n=int(input())+1#offset 1
a=0#answer
for p in permutations(range(n)):
 for i in range(2**n):#inversion
  v=[0]*(2**n)#visited
  c=0#number of cycles
  e=1#all is even
  for x in range(2**n):
   if v[x]:continue
   w=1#1 if this cycle is even
   while 1>v[x]:
    v[x]=1;w^=1
    x=reduce(lambda x,y:x+x+y,[1&(x>>s)for s in p])^i
   e&=w;c+=1
  a+=2**c*(1+e)
print(a//(2**n*factorial(n)*4))

#Come on... it's not that hard.
#Time complexity: 4**n*factorial(n)
#Memory complexity: 2**n
#(which is actually order of magnitude
#faster than the naive algorithm)

Try it online!

Next sequence


Originally intended to work in Python3, but Python 3 (Cython) raises an error "deallocating None".

Sorry for using Python, but programming on mobile is not easy. Posted 2 days ago in chat while waiting for someone else to post, probably with another language.

The next sequence has some chemistry-related things, but the recurrence relation is easy to implement. Ideally I hope someone will explain what the sequence is about. (I don't even explain most of my own answers...)

(Side note: Syntax highlighting fails for some comments)

333. Swift 3, 219 bytes, A000852

import Foundation
{typealias N=NumberFormatter;var i=$0+1,k=0;while i>0 {k+=1;let F=N();F.numberStyle=N.Style.spellOut;if "eo".contains("\(F.string(from:NSNumber(value:k))![" ".startIndex])"){i-=1}};print(k)}as(Int)->()

My previous Physica submission was invalid, because it didn't handle numbers like 14000. This is also compatible with Swift 4, and var f= needn't be included in the byte count.

Try it online!

Next sequence.

334. C (tcc), 157 bytes, A000219

Sigma_2(n){int s=0;for(int d=0;++d<=n;n%d||(s+=d*d));return s;}
A000219(n){if(!n)return 1;int s=0;for(int k=0;++k<=n;s+=A000219(n-k)*Sigma_2(k));return s/n;}

332. tinylisp, 852 bytes, A000766

(d in (q ((x xs) (i (e x (h xs)) 1 (i xs (in x (t xs)) 0

(d vec (q ((x y z) (c x (c y (c z (
(d + (q ((x y) (i x (c (a (h x) (h y)) (+ (t x) (t y))) (

(d map (q ((f xs) (i xs (c (f (h xs)) (map f (t xs))) (

(d sub (q ((exp pat rep) (i (e exp pat) rep (i (e (type exp) (q List)) (i exp (c (sub (h exp) pat rep) (sub (t exp) pat rep)) ()) exp
(d qt (q ((x) (c (q q) (c x (

(d - (s 0 1
(d adj (c (vec 1 1 0) (c (vec - 1 0) (c (vec 1 - 0) (c (vec - - 0) (c (vec 1 0 1) (c (vec - 0 1) (c (vec 1 0 -) (c (vec - 0 -) (c (vec 0 1 1) (c (vec 0 - 1) (c (vec 0 1 -) (c (vec 0 - -) (

(d sum (q ((ls) (i ls (a (h ls) (sum (t ls))) 0

(d sol (q ((ve pre n) (i (in ve pre) 0 (i n (sum (map (sub (sub (sub (q ((aj) (sol (+ VEC aj) PRE N))) (q VEC) (qt ve)) (q PRE) (qt (c ve pre))) (q N) (qt (s n 1))) adj)) (e (h ve) 1

(d main (q ((x) (sol (vec 0 0 0) () (a 1 x

Try it online!

Next sequence! Intentionally chosen to be easy. (somewhat weird, too)

... It was (not) fun learning this language.

Defines a function main which calculates the required function. tinylisp doesn't support reading from standard input.

Brute force approach. That's why it's terribly slow.


... There is library to load? In an esoteric language? Surprise!

331. Coconut, 766 bytes, A001854

# grow all roted trees on n labeled nodes
def grow(nodes, tree = (), r = ()):
	used_nodes = tuple(j for j in nodes |> range if any(j in k for k in tree)) or (0,)
	available_nodes = tuple(j for j in nodes |> range if j not in used_nodes)
	if not available_nodes: return tree |> sorted |> tuple,
	for node in used_nodes:
		for new_node in available_nodes: r += grow(nodes, (tree, ((node, new_node),)) |*> (+))
	return r |> set |> sorted |> tuple

# calculate a tree's height
def tree_height(tree):
	tree, lengths = tree |> list, {0: 0}
	while tree:
		for v in tree:
			if v[0] in lengths: lengths[v[1]] = lengths[v[0]]+1; tree.remove(v)
	return lengths.values() |> max

# implement A001854
def A001854(nodes): return (nodes, sum(map(tree_height, grow(nodes)))) |*> (*)

329. Yacas, 155 bytes, A000222

/* compute the series A000222 with yacas */
f(n) := Sum(k,2,n,Bin(2*n-k,k) * (n-k)! * (-1)^k * Bin(k,2));
/* only the space between ! and * is necessary */

Put it in a file and load it with Load("a000222"); - alternatively, there is an online demo of yacas here, you can paste the definition, press Shift+Enter, then input something like f(10); followed again by Shift+Enter.

Next sequence

I can explain the series and the formula, but there is a big gap between these explanations:

The crossrefs entry of A000222 says it is a diagonal of A058057.

The comments of that series describe n*n matrices where the main diagonal from (1,1) to (n,n) and the diagonal below from (2,1) to (n,n-1) have x entries and the remaining entries are 1.

The permanents of these matrices are polynomials in x. A058057 gives their coefficients. A bit of experimentation shows that A000222 consists of the coefficients of x^2.

It follows that A000222 gives the number permutations of {1,...,n} that have exactly two positions i that are mapped to i or (if i>1) to i-1.

That doesn't seem to help efficiently computing the series, I rather feel I have reconstructed the problem to which the permanent is the answer.

I had exciting ideas how to compute the permanent in the quotient ring Z[x]/(x^3), because doing it in Z[x] is unnecessary work, but there is an easier way.

The maple code for A058057 starts with a definition that expresses the polynomial as the sum of k from 0 to n of an integer expresssion in n and k times (x-1)^k. I don't know where this comes from, it might be explained in Riordan's book mentioned in the references. This book has come up often, I think I want it!

Anyway, the coefficient of x^2 of the last term is (-1)^k*binomial(k,2) for k>=2 and 0 otherwise, which leads to the formula used in the program.

330. Shakespeare Programming Language, 1854 bytes, A000155

Ye A000155 program.
Ajax, a of n minus four.
Brutus, a of n minus three.
Cicero, a of n minus two.
Dogberry, a of n minus one.
Isabella, input.
Miranda, counter.
Timon, a of n.

Act I: TBD.
Scene I: Taking input.

[Enter Isabella and Timon]

Timon:
       Listen to your heart! Are you worse than the sum of a big old cat and
       a pig?

Isabella:
       If so, you are me.

Timon:
       If so, let us proceed to Act II. Are you as bad as the sum of a furry
       black cat and a pig?

Isabella:
       If so, you are the sum of a beautiful trustworthy handsome pony and a
       coward.

Timon:
       If so, let us proceed to Act II.

[Exeunt Isabella and Timon]
[Enter Brutus and Cicero]

Brutus:
       You are a big chihuahua.

Cicero:
       You are a horse.

[Exeunt Brutus and Cicero]
[Enter Dogberry and Miranda]

Miranda:
       You are the sum of a amazing brave beautiful angel and a hog!

Dogberry:
       You are a pretty cute pony.

[Exit Dogberry]
[Enter Timon]

Scene II: The loop.

Miranda:
       You are the sum of Ajax and the product of a sunny sky and the sum of
       the product of Brutus and the difference between me and the sum of an
       animal and a delicious cow and the product of Dogberry and the sum of
       me and a toad. Am I as big as Isabella?

Timon:
       If so, let us proceed to Scene III.

[Exit Timon]
[Enter Ajax]

Ajax:
       You are the sum of you and a lantern.

Miranda:
       You are Brutus.

[Exeunt Ajax and Miranda]
[Enter Brutus and Cicero]

Cicero:
       You are me.

Brutus:
       You are Dogberry.

[Exeunt Brutus and Cicero]
[Enter Dogberry and Timon]

Timon:
       You are me.

[Exit Dogberry]
[Enter Miranda]

Miranda:
       Let us return to Scene II.

Scene III: TBD.

[Exit Miranda]
[Enter Isabella]

Act II: Finishing up.
Scene I: Output.

Isabella: Open thy heart!
[Exeunt]

Try it online!

Next sequence!

328. MY-BASIC, 222 bytes, A000439

def lin(n):return     n        :enddef
def sqr(n):return lin(n)*lin(n):enddef
def cub(n):return sqr(n)*lin(n):enddef
def hyp(n):return sqr(n)*sqr(n):enddef
def seq(n):return(hyp(n)+18*cub(n)+83*sqr(n)+114*lin(n))/24:enddef

327. tinylisp, 439 bytes, A000205

(load library)

(def x^2+3*y^2
 (lambda (x y)
  (add2
   (mul2 x x)
   (* y y 3))))

(def _sum-of-squares?
 (lambda (n x y)
  (if (equal? n (x^2+3*y^2 x y))
   1
   (if (less? n (x^2+3*y^2 x y))
    (if x
     (_sum-of-squares? n 0 (inc y))
     0)
    (_sum-of-squares? n (inc x) y)))))

(def sum-of-squares?
 (lambda (n)
  (_sum-of-squares? n 1 0)))

(def A000205
 (lambda (n)
  (length
   (filter sum-of-squares?
    (1to (pow 2 n))))))

Try it online!

Next sequence!

This is pretty slow, but it should work for any input, given enough time and memory.

The main function, A000205, generates all integers from 1 to 2^n; filters the list, keeping numbers of the form x^2+3*y^2; and returns the length of the resulting list.

There's probably a better way to check whether a number is of the form x^2+3*y^2. Here's the algorithm I used (see the function _sum-of-squares):

326. Lua, 205 bytes, A000385

function Sgm(n)D=0 for d=1,n do if n%d<1then D=D+d end end return D end
function Sum(a,b,f)S=0 for k=a,b do S=S+f(k)end return S end
function Seq(n)return Sum(1,n,function(k)return Sgm(k)*Sgm(-~n-k)end)end

324. Pyon, 559 bytes, A000238

import fractions,itertools
global fractions,k,R,itertools;# ugh
R=[0,1]
p=lambda a:[i*x for i,x in enumerate(a)][1:]
A=lambda a,b:list(map(sum,itertools.zip_longest(a,b,fillvalue=0)))
m=lambda p,q,n:[sum((p+k*[0])[i]*(q+k*[0])[k-i]for i in range(k+1))for k in range(len(p+q)-1)][:n]
for n in range(len(R),int(input())+2):
	P=[]
	for k in range(1, n):P=A(P,[fractions.Fraction(x,k)for x in[0if i%k else R[i//k]for i in range(n)]])
	f=[0,1];F=1
	for i in range(n):f=A(p(f),m(f,p([x*2for x in P]),n));F*=i+1
	R+=[f[0].numerator//F]
print(R[-1]-m(R,R,len(R))[-1])

Try it online!

Next sequence!

I initially wrote an answer that calculated A000150 in Befunge, then KSmarts answered, before Christian Sievers noticed that I've made that mistake. I took my code from this answer, added a call to mul to calculate a different sequence, and golfed it all a lot.

325. Perl 6, 385 bytes, A000559

my $n = get+3;
my @s = 0..$n;
my $result = 0;

for @s -> $k {
  $result = $result + stirling($n,$k)*stirling($k,3);
}

say $result;

sub stirling ($n, $k) {
  my @a = 0..$k;
  my $s = 0;
  for @a -> $j {
    $s = $s + ((-1)**($k-$j) * binom($k, $j) * $j**$n);
  }
  return $s / ([*] 1..$k);
}

sub binom ($n, $k) {
  my $l = $n-$k;
  return ([*] 1..$n) / ( ([*] 1..$k)*([*] 1..$l) );
}

An operator in square brackets is a reduction operator over a list. So [*] 1..$k is $k factorial.

Try it online!

Next Sequence

323. Common Lisp, 238 bytes, A000150

(defun catalan (n)
  (if (zerop n) 1 (/ (* 2 (+ n n -1) (catalan (1- n))) (1+ n))))
(let ((n (read)))
  (if (= n 0) (print 0)
    (if (evenp n)
      (print (/ (catalan n) 2))
      (print (/ (- (catalan n) (catalan (/ (- n 1) 2))) 2)))))

Try it online!

Next Sequence

322. Mathematica (10.1), 150 bytes, A000249

Symbol[StringJoin[FromCharacterCode[72], FromCharacterCode[101], FromCharacterCode[97], FromCharacterCode[100]]][#(****)&][Round[BesselK[Slot[1], 5]]]

Next sequence

A bit over-the-top due to the character requirement. Effectively the same as Round[#~BesselK~5]&.

321. Racket, 249 bytes, A000308

#lang racket/base
(define sub-one (λ (n) (+ n -1)))
(define sub-two (compose sub-one sub-one))
(define sub-thr (compose sub-one sub-two))
(define A000308 (λ (n) (if (< n 4) n (* (A000308 (sub-one n)) (A000308 (sub-two n)) (A000308 (sub-thr n))))))

319. C (8cc), 292 bytes, A001688

#include <math.h>

unsigned long factorial(unsigned long f) {
    if ( f == 0 ) 
        return 1;
    return(f * factorial(f - 1));
}

unsigned long long a(int n) {
    return factorial(n) * (pow(n,4) + (6*pow(n,3)) + (17*pow(n,2)) + (20*n) + 9);
}

int main(void) {
    printf("%d",a(4));
}

Next sequence

320. Java 7, 308 bytes, A000292

class Main{
  public static void main(String[] args){
    System.out.println(new Main().BinomialCoefficient(new Long(args[0])+2, 3));
  }
  
  static long BinomialCoefficient(long n, long k){
    return n==k || k<1?
        1
      :
        BinomialCoefficient(n-1, k) + BinomialCoefficient(n-1, k-1);
  }
}

Easy enough; calculates the Binomial Coefficient of n+2 and 3 as stated in the OEIS sequence.

Try it online.

Next sequence

318. Funciton, 1688 bytes, A000652

╔═══╗  ┌─────────╖  ┌─┐ ┌───╖  ╔═══╗
║   ╟──┤ str→int ╟──┤ └─┤ ↑ ╟──╢ 2 ║
╚═══╝  ╘═════════╝  │   ╘═╤═╝  ╚═══╝
  ┌─────────────────┘     │
┌─┴┐                      │
│┌─┴─╖                ┌───┴───┐
││ ♭ ║              ┌─┴─╖   ┌─┴─╖  
│╘═╤═╝┌───╖    ╔═══╗│ ♭ ║   │ ! ║  
│  └──┤ ↑ ╟────╢ 2 ║╘═╤═╝   ╘═╤═╝
│     ╘═╤═╝    ╚═╤═╝  │       │
│    ┌──┴─┐      │    └───┐   │
│  ┌─┴─╖  │┌───╖ │  ┌───╖ │   │
│  │ ! ║  └┤ ↑ ╟─┴──┤ ↑ ╟─┘   │
│  ╘═╤═╝   ╘═╤═╝    ╘═╤═╝     │
│    │ ┌───╖ │   ┌───╖│       │
│    └─┤ × ╟─┘ ┌─┤ × ╟┘       │
│      ╘═╤═╝   │ ╘═╤═╝ ┌───╖  │
│  ╔═══╗ └─────┘   └───┤ + ╟──┘
│  ║ 2 ╟┐              ╘═╤═╝
│  ╚═╤═╝│        ┌───╖   │
│    │  └──┐   ┌─┤ ÷ ╟───┘
│    └──┐┌─┴─╖ │ ╘═╤═╝┌─────────╖
│ ┌───╖ ││ ↑ ╟─┘   └──┤ int→str ╟─
└─┤ × ╟─┘╘═╤═╝        ╘═════════╝
  ╘═╤═╝    │
    └──────┘

Next Sequence

Calculates the formula from the OEIS page. I'm sure there's a more compact way to do this, without multiple 2 constants, but this took me long enough.

Try it online!

317. Python 3 (Cython), 652 bytes, A001808

from itertools import zip_longest

def mul(a, b):
	return list(map(sum, zip_longest(*[[0] * i + [e * f for j, f in enumerate(b)] for i, e in enumerate(a)], fillvalue = 0)))

# a(x) - b(x)
def sub(a,b):
	return list(map(lambda v: v[0] - v[1], zip_longest(a, b, fillvalue = 0)))

# a'(x)
def polyderiv(a):
	return[i*x for i,x in enumerate(a)][1:]

# (f(x)/g(x))', first n terms
def fracderiv(f,g):
	return sub(mul(polyderiv(f),g),mul(f,polyderiv(g))),mul(g,g)

f = [1]
g = [1,-11,54,-154,275,-297,132,132,-297,275,-154,54,-11,1]
F = 1

n = int(input())
for i in range(n):
	f, g = fracderiv(f, g)
	f = f[:n]
	g = g[:n]
	F*= i + 1

print(f[0] // g[0] // F)

Try it online!

Next sequence!

316. Pascal (FPC), 1808 bytes, A000147

{ ''' }
Type
	Num = Integer; // may change this to LongInt or big integer.
Const
	maxN = 1010; // Why using dynamic array?
Var
	ans, i, n, m, n0: Num;
	a: Array [1..maxN, 1..maxN] of Num;
Begin
	read(n0);
	inc(n0); // because input is 0-indexing.
	if n0 > maxN then
	begin
		writeln('Input too large!');
		halt;
	end;
	{ Let a[i, j] (a[i][j] in other languages. Pascal multidimensional
	array indexing looks nicer) be the number of rooted tree with
	(i) nodes, height at most 2 and all rooted subtree with its
	root being a child of the root has at least (j) nodes. }
	for m := 1 to n0 do
		a[1, m] := 1;
	{ Because if the tree only have a node, there is no rooted subtree.
	BTW, Sublime Text doesn't support Pascal well. }
	for n := 2 to n0 do
	begin
		a[n, n-1] := 1;
		for m := n-2 downto 1 do
			a[n, m] :=
			// When there is no rooted subtree of size (m).
			{ (line comment is FP's extension. TP doesn't have this)
			(TP = Turbo Pascal) }
			a[n, m+1]
			{ When there is a subtree of size (m), the remaining
			part is a tree of order (n-m) and each rooted subtree
			has at least (m) nodes. }
			+ a[n-m, m];
	end;
	{ From OEIS page: A tree of diameter 5 is formed from two rooted trees 
	of height 2, with their roots joined. }
	ans := 0;
	for i := 1 to (n0-1) div 2 do
		{ Assume one of the tree has order (i), then the other 
		has order (n0-i), where (n0) is the input. }
		ans += (a[i, 1] - 1) * (a[n0-i, 1] - 1);
		{ -1 because there is exactly one tree of height < 2
		and order = i. }
	if n mod 2 = 0 then
	begin // Assume both of the rooted subtrees has order (n div 2).
		i := a[n div 2, 1] - 1;
		ans += i * (i+1) div 2;
	end;
	writeln(ans); // ln = line.
End.
{ ''',



print(__import__('base64').b64decode(b'Tm90aGluZyBpbnRlcmVzdGluZy4uLiB0aGlzIGlzIG5vdCBQeXRob24u').decode('ascii')) }

Try it online!

Next sequence! Easy, just implement generating function.

315. Befunge-98 (PyFunge), 147 bytes, A004166

very simple :)
>"HTRF"4(1&>:!#v_1v <-- this loop here
  @.$<--out^\*3 \-< <-- calculates 3^n
 >;#_^#:/a\+%aO<\;#z<-- and here the digits are summed

Try it online!

Next sequence!

314. M, 4166 bytes, A000146

I hope I didn’t accidentally add any bytes outside of the M code page in the code.

The actual source code is the markdown source of this post. To prevent infinite recursion, the source can be found here.

Try it online! (with anti-infinite-recursion)

Next sequence!

Explanation

® ÆD ‘ ÆPÐf İ           ḷ“   First link. Calculate Sum_{(p-1)|2n} 1/p, with
                             the value of 2n stored in the register.
® ÆD                         All divisors of 2n (possible values of (p-1).
     ‘                  ḷ“   Increment. Get all possible values of (p).
       ÆPÐf                  Filter, keep only prime values.
            İ                Inverse.       ”
-* ×c@ × *®¥            ḷ“   Second (dyadic) link. Given v and k, calculate
                             (-1)^v * (k choose v) * v^m / (k+1). (m = 2*n),
                             a term from the closed-form formula.
-                            Literal -1.
 *                           Power. Current value = (-1)^v.
   ×c@                       Multiply (×) by the combination (c) with swapped (@)
                             arguments applied on k and v.
       × *®¥                 Multiply by the value of dyad applied on v...
         *                     Raise to power...
          ®                    register value (currently have value m = 2n)   ”
‘ Ḥ© 0r µ0r ç€ ÷‘µ€ ;-£ FS ḷ“ Main link.
‘                          ḷ“ Increment.
  Ḥ©                          Unhalve (double) the value, and store to register.
     0r                       Generate range from 0.
        µ........µ€           For each value (k),
         0r                     generate range from 0 (values (v)),
            ç€                  apply previous range for each element,
               ÷‘          ḷ“   and divide by (k+1).
                    ;-£       Concatenate the resulting list with the value of
                                the first link. x£ is "call link index x as a
                                nilad, excluding the main link, and wrap around".
                       FS     Flatten, and sum.         ”

313. PowerShell, 146 bytes, A001811

function A001811($n){
    [System.Numerics.BigInteger]$a=1;
    for ($i=1; $i -le $n; $i++) {
        $a=$a*($i+4)*($i+4)/$i
    }
    return $a
}

Online test suite

Next sequence: A000146

312. Python 2 (PyPy), 1811 bytes, A000334

partition_result_set = []
location_result_set = []
big_max = 1

def p_value(coord, value):
 global big_max
 i = value
 for d in coord:
  i = i * big_max + d
 return i

def partition(number, max, row = []):
 global partition_result_set
 if number == 0:
  partition_result_set[len(row) - 1] += [row]
  return
 
 for i in range(max, 0, -1):
  if number >= i:
   partition(number - i, i, row + [i])

def init_partitions(number):
 global partition_result_set
 for i in range(number):
  partition_result_set += [[]]

 partition(number, number)

def enumerate_locations(number_of_blocks, dimension, have_locations = [], possible_locations = []):
 global g, result_set, y, big_max, partition_result_set, location_result_set
 
 if possible_locations == []: 
  possible_locations = [[0] * dimension]
  y = [0] * number_of_blocks
  temp = number_of_blocks
  while temp > 0:
   big_max *= 10
   temp //= 10
 
 for location in possible_locations:
  new_have_locations = have_locations + [location]
  new_possible_locations = [l for l in possible_locations if l != location]
  for i in range(dimension):
   m = [location[d] + (1 if i == d else 0) for d in range(dimension)]
   is_ok = True
   for j in range(dimension):
    n = [m[d] - (1 if j == d else 0) for d in range(dimension)]
    if [d for d in n if d < 0] == [] and n not in new_have_locations: is_ok = False
   if is_ok: new_possible_locations += [m]

  len1 = len(new_have_locations)
  for x in partition_result_set[len1 - 1]:
   location_result_set += [repr(sorted([p_value(new_have_locations[k], x[k]) for k in range(len1)]))]
  if number_of_blocks > 1:
   enumerate_locations(number_of_blocks - 1, dimension, new_have_locations, new_possible_locations)

def A000334(n):
 init_partitions(n + 1)
 enumerate_locations(n + 1, 4)
 print len(set(location_result_set))

Try it online!

Next sequence: A001811, Laguerre Polynomial. At least there is a closed-form formula

Sorry for Python again, but when the question comes to enumeration I think Python is the easiest way to deal the question with.

311. ALGOL 68 (Genie), 334 bytes, A000148

BEGIN
  LONG LONG INT n   := read int + 2;
  LONG LONG INT r   := 0;
  LONG LONG REAL ma := ( n / 2.0 ) ** 1.5;
  LONG LONG REAL x  := 2.0 / 3;
  INT a             := 1;
  WHILE a <= ma DO
    INT b := a;
    WHILE a ** x + b ** x <= n DO
      r := r + 1;
      b := b + 1
    OD;
    a := a + 1
  OD;
  print ( whole ( r , 0 ) )
END

Next Sequence

Try it online!

308. ENIAC (simulator), 3025 bytes, A006060

Pseudocode:

repeat{
    M←input
    N←-M
    A←1
    B←253
    while(N<0){
        C←60
        C←C-A
        repeat(194){
            C←C+B
        }
        A←B
        B←C
        N←N+1
    }
    output←A
}

No online simulator, execution result: Card reader input Punch card output

Registers and constants:

A: 1-2
B: 3-4
C: 5-6
M: 7
N: 8

input: const. A
253: const. J
60: const. K
194: Master programmer decade limit 1B

Program signal flow and data flow: Program signal flow and data flow chart

Full "code" on pastebin or in HTML comments in the markup of this answer, to prevent linkrot and a quite long answer to scroll through at the same time. This is fun!

Next sequence

310. Pyth, 148 bytes, A000699

L?>b1*tbsm*y-bdydtUb1;*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1yh

Try it here!

Next Sequence.

I am going to regret using Pyth that soon. Implements a recursive function y that:

309. Haskell, 699 bytes, A003025

import Control.Monad
import Data.List

-- (n, es) has n nodes; es is a list of (i,j) where 1 <= i < j <= n.
type Dag = (Int, [(Int, Int)])

both f (a,b) = (f a, f b)
powerset = filterM (const [True, False])

-- All dags with n nodes.
dags :: Int -> [Dag]
dags n = map ((,) n) $ powerset [(i,j) | i <- [1..n], j <- [i+1..n]]

-- Is there only one node with no exits?
ok :: Dag -> Bool
ok (n, es) = not $ any (\i -> not $ any ((==i) . fst) es) [1..n-1]

-- All ways to relabel the given dag.
rewrites :: Dag -> [Dag]
rewrites (n, es) = [(n, sort $ map (both ((p!!) . pred)) es) | p <- permutations [1..n]]

-- A003025
f :: Int -> Integer
f = genericLength . nub . concatMap rewrites . filter ok . dags

Try it online!

Enumerates the n-node labeled acyclic digraphs with 1 out-point.

print (f 5) produces the correct output (16885) after 20 seconds when compiled with -O3.

Next sequence

307. Scratch 2, 6060 bytes, A002113

enter image description here

Try it online!

Next Sequence

Relevant part:

"scripts": [[639, 148.5, [["letter:of:", 1, ["readVariable", "is_palindrome"]]]],
    [683, 370, [["readVariable", "counter"]]],
    [697, 365, [["readVariable", "n"]]],
    [59,
        92,
        [["whenGreenFlag"],
            ["deleteLine:ofList:", "all", "palindromes"],
            ["doAsk", "n: "],
            ["setVar:to:", "n", ["answer"]],
            ["setVar:to:", "counter", 0],
            ["doUntil",
                ["=", ["lineCountOfList:", "palindromes"], ["readVariable", "n"]],
                [["setVar:to:", "is_palindrome", "1"],
                    ["setVar:to:", "i", 0],
                    ["doRepeat",
                        ["stringLength:", ["readVariable", "counter"]],
                        [["doIf",
                                ["not",
                                    ["=",
                                        ["letter:of:", ["+", ["readVariable", "i"], 1], ["readVariable", "counter"]],
                                        ["letter:of:",
                                            ["-", ["stringLength:", ["readVariable", "counter"]], ["readVariable", "i"]],
                                            ["readVariable", "counter"]]]],
                                [["setVar:to:", "is_palindrome", 0]]],
                            ["changeVar:by:", "i", 1]]],
                    ["doIf",
                        ["=", ["readVariable", "is_palindrome"], "1"],
                        [["append:toList:", ["readVariable", "counter"], "palindromes"]]],
                    ["changeVar:by:", "counter", 1]]]]]],

Full code: https://pastebin.com/jEc5W0SL

305. JavaScript (Node.js), 145 bytes, A000143

p=Math.pow
a=(n)=>{q=!n/16;
for(i=1;i<=n;i++){if(!(n%i))q+=p(-1,i)*p(i,3)}return q*16*p(-1,n)}
//Filing out characters to get to nearest empty ch

Try it online!

Next sequence

If you by chance consider comments cheating here's the same code ungolfed with the same length

a = function(n) {
	q=!n/16;
	for (i = 1; i <= n; i++) {
		if (n%i==0) q += Math.pow(-1, i) * Math.pow(i, 3)
	}
	return q * 16 * Math.pow(-1, n)
}

Try it online!

306. Python 3, 2113 bytes, A000145

def intsqrt(n):
 if n == 0: return 0
 counter, temp = 1, 1
 while counter < n:
  counter <<= 2
  temp <<= 1
 oldtemp1, oldtemp2 = 0, 0
 while oldtemp2 != temp and temp > 0:
  oldtemp2, oldtemp1, temp = oldtemp1, temp, (temp + n // temp) >> 1
 return oldtemp1

def factorial(n):
 if n == 0:
  return 1
 else:
  return n * factorial(n - 1)

def GenerateSquareSequence(n):
 s = 0
 for a in range(intsqrt(n), -1, -1):
  for b in range(min(a, intsqrt(n - a*a)), -1, -1):
   for c in range(min(a, b, intsqrt(n - a*a - b*b)), -1, -1):
    for d in range(min(a, b, c, intsqrt(n - a*a - b*b - c*c)), -1, -1):
     for e in range(min(a, b, c, d, intsqrt(n - a*a - b*b - c*c - d*d)), -1, -1):
      for f in range(min(a, b, c, d, e, intsqrt(n - a*a - b*b - c*c - d*d - e*e)), -1, -1):
       for g in range(min(a, b, c, d, e, f, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f)), -1, -1):
        for h in range(min(a, b, c, d, e, f, g, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f - g*g)), -1, -1):
         for i in range(min(a, b, c, d, e, f, g, h, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f - g*g - h*h)), -1, -1):
          for j in range(min(a, b, c, d, e, f, g, h, i, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f - g*g - h*h - i*i)), -1, -1):
           for k in range(min(a, b, c, d, e, f, g, h, i, j, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f - g*g - h*h - i*i - j*j)), -1, -1):
            for l in range(min(a, b, c, d, e, f, g, h, i, j, k, intsqrt(n - a*a - b*b - c*c - d*d - e*e - f*f - g*g - h*h - i*i - j*j - k*k)), -1, -1):
             if a*a + b*b + c*c + d*d + e*e + f*f + g*g + h*h + i*i + j*j + k*k + l*l == n:
              t = (a, b, c, d, e, f, g, h, i, j, k, l)
              u = []
              for m in range(0, 4096):
               v = [t[o] * (-1)**(m >> o) for o in range(0, 12)] 
               u.append(repr(sorted(v)))
              w = set(u)
              x = [eval(y) for y in w]
              for z in x:
               p = [z.count(o) for o in set(z)]
               q = 479001600
               for r in p:
                q = q // factorial(r)
               s += q
 return s

Try it online!

Next sequence: A002113: palindromic number

Sorry for the counting by exhaustion algorithm (and the 14-layer for loop), but the sequence also counts representations with negative numbers into the total.

304. Clojure, 143 bytes, A000203

(defn sigma
   [num]
   (reduce +
      (filter
         (comp zero?
            (partial rem num))
         (range 1
            (+ 1 num)))))

Try it online!

Next sequence

303. APL (Dyalog), 203 bytes, A000135

{n←1+⍵⋄++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++≢⊃{{(n≥⍵)/⍵},⍵,⍺+0,⍵}/(2÷3)*⍨1+⍳⌊1.5*⍨n}

Try it online!

using ⎕IO←0. After removing fillers (+, conjugate in Dyalog APL but it doesn't change the result becuase we're dealing real numbers here):

{n←1+⍵⋄≢⊃{{(n≥⍵)/⍵},⍵,⍺+0,⍵}/(2÷3)*⍨1+⍳⌊1.5*⍨n}

Next sequence

124. ArnoldC, 796 bytes, A000278

IT'S SHOWTIME

HEY CHRISTMAS TREE input
YOU SET US UP @I LIED
HEY CHRISTMAS TREE result
YOU SET US UP @I LIED
HEY CHRISTMAS TREE x
YOU SET US UP @I LIED
HEY CHRISTMAS TREE y
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE temp1
YOU SET US UP @I LIED

GET YOUR ASS TO MARS input
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY

STICK AROUND input

GET TO THE CHOPPER temp1
HERE IS MY INVITATION x
ENOUGH TALK

GET TO THE CHOPPER x
HERE IS MY INVITATION x
GET UP y
ENOUGH TALK

GET TO THE CHOPPER y
HERE IS MY INVITATION temp1
YOU'RE FIRED temp1
ENOUGH TALK

GET TO THE CHOPPER input
HERE IS MY INVITATION input
GET DOWN 1
ENOUGH TALK

CHILL

GET TO THE CHOPPER result
HERE IS MY INVITATION x
ENOUGH TALK

TALK TO THE HAND result
YOU HAVE BEEN TERMINATED

Try it Online!

Next Sequence

132. Java (OpenJDK 9), 903 bytes, A000116

import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int input = in.nextInt();
        if(input<=0) System.out.print(1);
        else System.out.print(A000013(2*input));
    }

    public static int A000013(int n) {  // Uses the formula from the OEIS page
        double result = 0;
        for(int d = 1; d<=n; d++) {
            if(n%d==0) {
                double t = totient(2*d);
                double b = Math.pow(2,n/d);
                result += (t*b)/(2*n);
            }
        }
        int r = (int) result;
        return r;
    }

    public static int totient(int n) {  // Follows the definition of Euler's Totient
        int count = 0;
        for(int i = 1; i<n; i++) {
            if(GCD(n,i)==1) count++;
        }
        return count;
    }

    public static int GCD(int a, int b) {  // Uses Euclid's Algorithm for GCD
        if(a<b) {
            if(b%a==0) return a;
            return GCD(b%a, a);
        }
        if(a%b==0) return b;
        return GCD(a%b, b);


    }
}

Try it online!

Next Sequence

I thought I ought to do this one, since it re-implements A000013 and I did that one in the first place.

137. Squirrel, 701 bytes, A000232

function A000232(index) {
local GBTriangle = [[]]
local numbers = []

for(local i=1; i<index*index*index; i++) numbers.append(i);

// Generate primes with Sieve of Sundaram
for(local i=1; i<numbers.len(); i++) {
  for(local j=i; i+j+2*i*j<numbers.len(); j++)
    numbers[i+j+2*i*j]=0;
}
for(local i=0; i<numbers.len(); i++) {
  if(numbers[i]>0)
    GBTriangle[0].append(2*numbers[i]+1);
}

// Build the triangle
for(local i=1; i<=index; i++) {
  GBTriangle.append([])
  for(local a=1; a<GBTriangle[i-1].len(); a++) {
    GBTriangle[i].append( abs( GBTriangle[i-1][a] - GBTriangle[i-1][a-1] ))
  }
}

for(local i=0; i<GBTriangle[index-1].len(); i++) {
  if(GBTriangle[index-1][i]>2)
    return i;
}

}

Try it Online!

Next Sequence

184. CJam, 142 bytes, A000061

{_,@f*\f%1\{)1$f-@+:*\}h;g}:J;
{)_mF{~2/#}%:*:M_*/:B_4%1={_2/,f{)_2$J@@4*-*}}{_,{1&},f{1$1$J@@-*}}?1b0.5e|M3#*Mmf{2>},_&{_2#_@B\J-@*\/}/0.5+i}

Online test suite. This is an anonymous block (function) with an auxiliary named block (function) to calculate the Jacobi symbol.

Note: the formulae given in OEIS as it currently stands (revision 39) are badly transcribed from the Shanks paper. They miss an exponent and one special case and give a different special case incorrectly. I shall propose amendments.

Also note that for the Jacobi symbol I'm using the Zolotarev-style approach I mentioned in an earlier answer of calculating the Levi-Civita symbol of a linear map. The implementation of J above is not the same as the one I previously proposed: it's the same length, but I think it's less wasteful.

The next sequence is a nice easy one, so maybe someone can bring the lowest uncovered sequence, A000017, into play. That should make the hard-coders happy.

222. Julia 0.4, 110 bytes, A000670

function A000670(n)
 S = 0
 for k = 0:n
  for j = 0:k
   S = S + (-1)^(k-j)*binomial(k,j)*j^n
  end
 end
S
end

Try it online!

Next sequence

Implements the formula found on wikipedia to compute a(n) as a sum of binomial coefficients. I suppose I could have implemented this in another language like Racket or something but whatever. Next seq is the Bell numbers, this sequence is the ordered Bell numbers which I find amusing (since they're out of order).

302. MOO, 135 bytes, A000165

return 2 ^ args[1]* $sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.sysobj.math_utils:factorial(args[1]);

The $sysobj.sysobj.sysobj.sysobj. is pure padding to avoid a duplicate sequence; return 2 ^ args[1]* $math_utils:factorial(args[1]) would do the same thing.

Next sequence

301. Trefunge-98 (PyFunge), 165 bytes, A002407

"HTRF"4($$&1>::1+::**\::**-3>::*2Pv
        v\$\+#-1_z#;$.@;:R$;^  +2;wOO%#;_v
        >  1^1                  $$<      <
Yup, Trefunge. Don't worry, I'm not insane.

Try it online!

Next sequence!

300. C# (.NET Core), 2407 bytes, A000137

using System;
using System.Numerics;

public class A000137 {

 // Expands the polynomial (1 / x^k)
 public static BigInteger[] ExpandReciprocalPowerK(int k, int max) {
  BigInteger[] result = new BigInteger[max + 1];
  for (int i = 0; i <= max; i++) {
   if (i % k == 0)
    result[i] = new BigInteger(1);
   else
    result[i] = new BigInteger(0);
  }
  return result;
 }

 // Calculates p1(x) * p2(x)
 public static BigInteger[] PolynomialMultiply(BigInteger[] x, BigInteger[] y, int max) {
  BigInteger[] result = new BigInteger[max + 1];
  for (int i = 0; i <= max; i++) {
   for (int j = 0; j <= max - i; j++) {
    if (result[i + j] == null)
     result[i + j] = new BigInteger(0);
    result[i + j] += x[i] * y[j];
   }
  }
  return result;
 }

 // Calculates (p(x))^n
 public static BigInteger[] PolynomialPower(BigInteger[] x, BigInteger n, int max) {
  BigInteger[] result = x;
  if (BigInteger.Compare(n, new BigInteger(0)) == 0) {
   result = new BigInteger[max + 1];
   result[0] = new BigInteger(1);
   for (int i = 1; i <= max; i++)
    result[i] = new BigInteger(0);
  }
  if (BigInteger.Compare(n, new BigInteger(2)) < 0)
   return result;

  BigInteger counter = new BigInteger(1);
  while (BigInteger.Compare(counter, n >> 2) <= 0)
   counter <<= 1;
  
  while (BigInteger.Compare(counter, new BigInteger(0)) > 0) {
   result = PolynomialMultiply(result, result, max);
   if (BigInteger.Compare(n & counter, new BigInteger(0)) != 0)
    result = PolynomialMultiply(result, x, max);
   counter >>= 1;
  }
  return result;
 }
 
 public static void Main(string[] args) {
  try {
   // Get Input
   int n = int.Parse(args[0]);
   BigInteger[] x1 = ExpandReciprocalPowerK(1, n);
   for (int i = 2; i <= n; i++) {
    BigInteger coeff = x1[i];
    x1 = PolynomialMultiply(x1, PolynomialPower(ExpandReciprocalPowerK(i, n), coeff, n), n);
   }

   BigInteger[] x2 = new BigInteger[n + 1], x3 = new BigInteger[n + 1], x4 = new BigInteger[n + 1];
   x3[0] = x2[0] = new BigInteger(1) - x1[0]; 
   x4[0] = new BigInteger(1);
   for (int i = 1; i <= n; i++)
    x4[i] = x3[i] = x2[i] = x1[i];
   for (int i = 2; i <= n; i++) {
    x3 = PolynomialMultiply(x3, x2, n);
    for (int j = 0; j <= n; j++)
     x4[j] += x3[j];
   }
   BigInteger[] x5 = PolynomialMultiply(x1, x4, n);

   Console.WriteLine(x5[n]); // A000137 is not zero-offset
  }
  catch (Exception e) {
   Console.WriteLine(e);
  }
 }

}

Try it online!

Next sequence: A002407, Cuban primes

Second .NET Core C# answer in the first 300 (Since TIO shows both .NET Core and Visual C# Compiler so I assume the two to be different).

Implementation of the algorithm(Mathematica) in the A000137 page in C#, courtesy to Jean-François Alcover (2016).

I tried to find the pattern, but failed to arrive an algorithm that solves it. Used Maclaurin series to calculate the expansion of 1/(1-p(x)) where p is a polynomial of x.

Added some lines so that it points to a nice one

299. Unefunge-98 (PyFunge), 137 bytes, A001008

&1+3p01p12p2g3g::/1-:/d*j:0p%0g\0f-8-j$:3g\/:1g*1p\2g\/1g+1p2g*2p1g2g::/1-:/d*j:0p%0g\0f-8-j$:1g\/1p2g\/2p3g1-:3p:/0ab*-3-*j1g.@ unefunge

Try it online!

Next sequence!

Due to the way PyFunge handles input, the input to this program has to be followed by at least one newline.

Explanation

I'm calculating GCD twice, both times using the Euclidean algorithm, which is a simple one-liner in Python: while b: a, b = b, a % b (the result is left in a). Here is it implemented in Unefunge:

::/1-:/d*j:0p%0g\0f-8-j$ Stack: a b
::/1-:/d*j               If b is equal to 0, skip to the $ at the end
          :0p            Save b in a temporary variable
             %           Stack: a%b
              0g\        Recall b and swap. Stack: b a%b
                 0f-8-j  Jump to the beginning
                       $ Drop b, which is now equal to 0.

In the explanation of the whole program, I'll replace this snippet with a G. The program uses its first 4 bytes as variables, since the programs in Unefunge can easily modify themselves.

Byte no    Letter   Purpose
    0               A temporary variable used in the GCD algorithm
    1         n     The numerator of the partial sum
    2         d     The denominator of the partial sum
    3         i     The loop counter

This should be enough to understand the whole program.

&1+3p       i = int(input()) + 1
01p         n = 0
12p         d = 1
            The main loop starts here
2g3gG:      gcd = GCD(d, i) # Stack: gcd, gcd
3g\/:                       # Stack: gcd, i // gcd, i // gcd
1g*1p       n *= i // gcd   # Stack: gcd, i // gcd
\2g\/1g+1p  n += d // gcd   # Stack: i // gcd
2g*2p       d *= i // gcd   # Stack empty
1g2gG:      gcd = GCD(n, d) # Stack: gcd, gcd
1g\/1p      n //= gcd
2g\/2p      d //= gcd
3g1-:3p     i -= 1
:/0ab*-3-*j If i is not 0, loop
1g.@        print(n)

298. dc, 1008 bytes, A001460

# Define a factorial macro f; expects the accumulator in register a and the loop number
# (> 0) on the stack
[
 d        # Duplicate the loop number
 la * sa  # Load accumulator, multiply by loop number, store back in accumulator
 1 -      # Decrement loop number
 d 0<f    # Duplicate; if greater than 0, call the macro again
] sf

# Define a wrapper macro F; expects the argument on the stack, and can handle 0
[
 1 sa   # Store 1 in the accumulator register
 d 0<f  # Duplicate argument; if greater than 0, call macro f
 s_     # This leaves a 0 on the stack; store in register _ to get rid of it
 la     # Load accumulator onto stack
] sF

# Main program
? sn         # Read input and store in register n
ln 5 * lF x  # Load n, multiply by 5, take the factorial
ln 2 * lF x  # Load n, multiply by 2, take the factorial
ln lF x 3 ^  # Load n, take the factorial, raise to the 3rd power
*            # Multiply the last two results
/            # Divide the first result by the product
p            # Print

Try it online!

Next sequence.

297. Shakespeare Programming Language, 1460 bytes, A000161

A000161 - Number of partitions of n into 2 squares.
Romeo, the first square.
Juliet, the second square.
Othello, the input.
Macbeth, the counter.
Hamlet, the narrator.
The Ghost, the temporary actor one.

          Act I: Main Program.
       Scene I: Retrieving Input.

[Enter Hamlet and Othello]
 Hamlet:
  Listen to your heart!
[Exeunt]
  
       Scene II: Initialization.

[Enter Romeo and Juliet]
 Juliet:
  You are nothing!
[Exit Juliet]
[Enter Macbeth]
 Romeo:
  You are as good as me!
[Exeunt]

       Scene III: Calculation.

[Exeunt]
[Enter Romeo and The Ghost]
 Romeo:
  You are as bad as the product of me and me!
[Exit The Ghost]
[Enter Juliet]
 Romeo:
  You are as lovely as the square root of the difference between Othello and The Ghost!
 Juliet:
  Is Othello as lovely as the sum of the product of me and me and the product of you and you?
 Romeo:
  If not, let us proceed to Scene V.
[Exeunt]

       Scene IV: Add One.

[Enter Romeo and Macbeth]
 Romeo:
  You are as good as the sum of yourself and a flower.
[Exeunt]

       Scene V: Decision.

[Exeunt]
[Enter Romeo and Hamlet]
 Hamlet:
  You are as good as the sum of yourself and a flower.
 Romeo:
  Am I not better than the square root of Othello?
 Hamlet:
  If so, let us proceed to Scene III.
[Exeunt]

       Scene VI: Ending.

[Enter Hamlet and Macbeth]
 Hamlet:
  You are as good as the quotient between the sum of you and a flower and a beautiful flower. Open your heart!
[Exeunt]

Try it online!

Next sequence: A001460 - just some trivial factorial things

Added some padding bytes so that the next one will not be calculating on the graphs (originally 1429 bytes).

Added more padding so that the sequence points to a 0-indexed array

Translated code (Python):

import math
R, O = 0, input()              # Act I Scene I & II
M = R                          # Act I Scene I & II
while R <= int(math.sqrt(O)):  # Act I Scene V
 G = R * R                     # Act I Scene III
 J = int(math.sqrt(O - G))     # Act I Scene III
 if O == R * R + J * J:        # Act I Scene III
  M = M + 1                    # Act I Scene IV
 R = R + 1                     # Act I Scene V
print (M + 1) // 2             # Act I Scene VI result = ceil(M / 2)
                               #                because all except n=2a² are counted twice

289. Pyt, 149 bytes, A000186

←Đ000`ŕ4ȘĐ4ȘĐĐĐ5ȘĐĐ5Ș↔⇹5Ș6Ș8Ș3Ș6Ș4Ș⇹3Ș↔⁺3*~4Ș-+~ĐĐ1~⇹^4ȘÅĐ3Ș⇹+⁻ŘΠ⇹↔Đ↔9Ș↔!3Ș⇹3Ș*⇹!÷*3ȘĐ2⇹^⇹!3Ș4Ș⇹÷*⇹Đ0≥*!*+⇹Đ3Ș⇹⁻3Șłŕ⇹ŕ↔Đ↔⇹3Ș⇹3ȘĐ3Ș⇹⁻Đ5Ș4Ș-3Ș⇹łŕ3Ș↔ŕƥĉ


The program is a port of the Mathematica algorithm listed on the OEIS page.

Most of the work done is managing the stack.

Try it online!

Next sequence: floor(e^n)

296. Pyt, 161 bytes, A000133

←ĐĐĐ1⇹1⇹««⇹1⇹«⁻⇹3Ș⁻1⇹«⁺1⇹«*+⇹⁺1⇹«÷                                                                                                                               

All of those spaces at the end are padding.

Try it online!

Next Sequence!

295. Unefunge-98 (PyFunge), 133 bytes, A000218

#z3&#rz#;::/3*j$.@1-\:a%:*\a/:a%:*\a/:*++\#;r
print(*map(lambda x:'pHra ywe!NY'[int(x, 16)], '%x'%(3*7*8*1821847*279590039)), sep='')

Next sequence!

Try it online!

#z3&#rz#;::/3*j$.@1-\:a%:*\a/:a%:*\a/:*++\#;r
#z                                            Kind of serves no purpose...
  3                                           Starting number of the sequence
   &                                          Input the number of iterations
    #rz#;                                 #;r Set up a way to jump to the
                                              beginning
         ::/                                  Make a copy of the loop counter and
                                              divide it by itself. Since 0/0 is
                                              defined as 0 in Funge, this leaves
                                              1 on the stack when the loop
                                              counter is not zero, but 0 when it
                                              is
            3*                                Multiply the result by 3 to skip
                                              $.@
              $.@                             When the loop ends, print the
                                              result
                 1-                           Decrement the loop counter
                   \:a%:*\a/:a%:*\a/:*++\     Calculate the next element of the
                                              sequence.

294. Swift 3, 218 bytes, A000431

import Foundation

infix operator **
func **(_ base: Int, _ exponent: Int) -> Int{
    return Int(pow(Double(base), Double(exponent)))
}

func A000431(_ n: Int) -> Int {
	return ((4 ** Int(n)) - ((2**(n+1)) * n)) / 8
}

Try it online!

Next Sequence.

Note that I have previously used Swift 4 (twice), but this time I used Swift 3. This version thankfully works in both Swift 3 and Swift 4, so this can be tested online.

43. Swift 4, 651 bytes, A000028

func bit_sum_parity(n: Int) -> Int {
    var res = 0;
    var test = n;
    while test > 0 {
        res ^= test%2;
        test /= 2;
    }
    return res;
}

func A000028(n: Int) -> Int {
    var res = 1;
    var iter = n;
    while iter > 0 {
        var clone = res;
        var p = 2;
        var parity = 0;
        while clone > 1 {
            var count = 0;
            while clone % p == 0 {
                clone /= p;
                count += 1;
            }
            parity ^= bit_sum_parity(n: count);
            p += 1;
        }
        if parity == 1 {
            iter -= 1;
        }
        res += 1;
    }
    return res-1;
}

Try it online!

Next Sequence - A000651

293. Commodore 64 BASIC, 431 bytes, A000132

10 R=0
20 INPUT N
30 FOR A=0 TO FLOOR(SQR(N))
40 F=N-A*A
50 FOR B=0 TO FLOOR(SQR(F))
60 G=F-B*B
70 FOR C=0 TO FLOOR(SQR(G))
80 H=G-C*C
90 FOR D=0 TO FLOOR(SQR(H))
100 L=H-D*D
110 E=FLOOR(SQR(L))
120 IF E*E<>L GOTO 200
130 Z=1
140 IF A<>0 THEN Z=Z*2
150 IF B<>0 THEN Z=Z*2
160 IF C<>0 THEN Z=Z*2
170 IF D<>0 THEN Z=Z*2
180 IF E<>0 THEN Z=Z*2
190 R=R+Z
200 NEXT D
210 NEXT C
220 NEXT B
230 NEXT A
240 PRINT R

Next sequence!

Sorry, but no TIO link this time. This will have to do:

an animated GIF

(bytecount measured according to this meta post)

256. Pygmy Forth, 562 bytes, A000454

CODE PICK  dpush(_stack[~dpop()]) END-CODE
: COEFFICIENT-A(N-1) 2 * 5 - 2 * ;
: COEFFICIENT-A(N-2) DUP 6 - * 6 * 55 + ;
: COEFFICIENT-A(N-3) DUP DUP 7 - * 2 * 25 + SWAP 2 * 7 - * ;
: COEFFICIENT-A(N-4) 4 - DUP * DUP * ;
: ADVANCE DUP COEFFICIENT-A(N-1) 2 PICK * OVER COEFFICIENT-A(N-2) 4 PICK * - OVER COEFFICIENT-A(N-3) 5 PICK * + OVER COEFFICIENT-A(N-4) 6 PICK * - SWAP 1 + ;
CODE ADVANCE-LOOP  for i in range(dpop()): ADVANCE() END-CODE
CODE CLEAN-STACK  global _stack; _stack = [_stack[-1]] END-CODE
: A000454 0 0 0 1 5 5 PICK ADVANCE-LOOP DROP CLEAN-STACK ;

Next sequence!

Nice, round number of answers! Computes up to 16 A454 on 64-bit Forths, and you can Try It Online! on gforth with some modifications. However, Pygmy Forth is arbitrary precision and it can compute n=1000 in a blink of an eye.

Explanation

Forth is a stack-based language, like 05AB1E or Actually, but it was not designed that way to be esoteric. Forth was designed in 1970, and being stack based allowed the interpreter to fit in extremely small space - even now, an x86 interpreter could fit in the MBR and VBR (two 512 byte sectors) of a hard disk, with the code loaded from a FAT32 filesystem (first-hand experience). The most important consequences of the stack-oriented design are the postfix notation in which all calculations are described, and having to keep the words ("functions") small so you don't get lost. Breaking up a word into smaller chunks is called factoring.

ADVANCE expects the last 4 numbers of the sequence on the stack, with a cherry the sequence index n on top, and calculates the next number in the sequence as well as increments n. The sequence can start as 0, 0, 0, 1, and the next number will be assigned the index of 5, so you can calculate a specific element of the sequence like this:

0 0 0 1 5 ADVANCE ADVANCE ADVANCE ADVANCE ADVANCE
DROP ( the index )
. ( print )

Now we only need to loop ADVANCE a given number of times, and this is exactly what A454 does. The 0 0 0 1 5 at the beginning initializes the stack, then 5 PICK brings the argument this word was given to the top. Normally in Forth, one would do limit start ?DO stuff LOOP, which is a construct equivalent to Python's for i in range(start, limit): stuff. However, Pygmy Forth is missing a lot of words, so I have to make up for it with CODE, which is used to define words in Python. At the end of A454, DROP is used to remove the sequence index, leaving the result at the top of the stack.

258. Forth (gforth), 329 bytes, A000144

: ODDQ 2 MOD ;
: EVENQ 1+ ODDQ ;
: DIVOK /MOD SWAP IF DROP 0 ELSE ODDQ THEN ;
: A2131 DUP 1+ 0 SWAP 1 ?DO OVER I DIVOK IF I + THEN LOOP NIP ;
: A186690 DUP A2131 SWAP EVENQ IF 0 SWAP - THEN ;
: ADVANCE DUP 1+ 0 SWAP 1 ?DO I 1+ PICK I A186690 * + LOOP 20 * OVER / SWAP 1+ ;
: A144 1 SWAP 1 SWAP 0 ?DO ADVANCE LOOP 1 ?DO NIP LOOP ;

Try it online!

Next sequence!

This time I managed to remove the surplus elements from the stack with 1 ?DO NIP LOOP.

292. Gaia, 132 bytes, A000130

ọ0D¦1C1=
┅f↑¦Σ2÷                                                                                                                    

Try it online!

Next sequence.

The next one should not be too hard (there is a näive approach to generate all the integer partitions, and for each partition P check if P is of length 5 and that each element in P is a square :P). I have solved this in Pyth first, then got a much more efficient technique, which I then ported to Gaia.

How it works?

ọ0D¦1C1= | Helper function.

ọ        | Compute the incremental differences (deltas).
 0D¦     | For each, calculate the absolute difference to 0 (absolute value).
    1C   | Count the 1's.
      1= | Return 1 if the result is equal to 1, 0 otherwise.

┅f↑¦Σ2÷  | Main function. Let N be the input.

┅        | The integers in the range 1 ... N.
 f       | Compute the permutations.
  ↑¦     | For each permutation, apply the above helper function called monadically.
    Σ    | Sum.
     2÷  | Halve and implicitly display the result.

291. Whispers, 130 bytes, A000337

> Input
> 1
> 2
>> 1-2
>> 3*1
>> 4×5
>> 6+2
>> Output 7
As usual, padding is required
to make this a valid answer
Whispers rules!

Try it online!

Next sequence

290. Hy, 337 bytes, A000149

(import decimal)
(setv ctx (.getcontext decimal))
(setv ctx.prec 500)
(setv iterations 2800)

(defn factorial [n]
  (reduce *
    (range 1 (inc n))
    1))

(defn exp [n series-terms]
  (sum
    (list-comp
      (/ (decimal.Decimal (** n k)) (factorial k))
      (k (range series-terms)))))

(defn A000149 [n]
  (int (exp n iterations)))

Next sequence--here's a nice easy one so you can break out the obscure esolangs. ;^)

We implement the exponential function by taking partial sums of its MacLaurin series: e^n = Sum[k=0..inf] n^k/k!. For values far away from 0, the series converges more slowly, so we need to calculate a lot of terms to get an accurate result. Trial and error showed that 2800 terms was sufficient for n=1000. The decimal module provides arbitrary-precision arithmetic; 500 significant digits gets us up to n=1000 easily.

281. Java 5, 11628 bytes, A000947

// package oeis_challenge;

import java.util.*;
import java.lang.*;

class Main {

//  static void assert(boolean cond) {
//      if (!cond)
//          throw new Error("Assertion failed!");
//  }

    /* Use the formula a(n) = A000063(n + 2) - A000936(n).
    It's unfair that I use the formula of "number of free polyenoid with n
    nodes and symmetry point group C_{2v}" (formula listed in A000063)
    without understanding why it's true...
    */

    static int catalan(int x) {
        int ans = 1;
        for (int i = 1; i <= x; ++i)
            ans = ans * (2*x+1-i) / i;
        return ans / -~x;
    }

    static int A63(int n) {
        int ans = catalan(n/2 - 1);
        if (n%4 == 0) ans -= catalan(n/4 - 1);
        if (n%6 == 0) ans -= catalan(n/6 - 1);
        return ans;
    }

    static class Point implements Comparable<Point> {
        final int x, y;
        Point(int _x, int _y) {
            x = _x; y = _y;
        }

        /// @return true if this is a point, false otherwise (this is a vector)
        public boolean isPoint() {
            return (x + y) % 3 != 0;
        }

        /// Translate this point by a vector.
        public Point add(Point p) {
            assert(this.isPoint() && ! p.isPoint());
            return new Point(x + p.x, y + p.y);
        }

        /// Reflect this point along x-axis.
        public Point reflectX() {
            return new Point(x - y, -y);
        }

        /// Rotate this point 60 degrees counter-clockwise.
        public Point rot60() {
            return new Point(x - y, x);
        }

        @Override
        public boolean equals(Object o) {
            if (!(o instanceof Point)) return false;
            Point p = (Point) o;
            return x == p.x && y == p.y;
        }

        @Override
        public int hashCode() {
            return 21521 * (3491 + x) + y;
        }

        public String toString() {
            // return String.format("(%d, %d)", x, y);
            return String.format("setxy %d %d", x * 50 - y * 25, y * 40);
        }

        public int compareTo(Point p) {
            int a = Integer.valueOf(x).compareTo(p.x);
            if (a != 0) return a;
            return Integer.valueOf(y).compareTo(p.y);
        }

        /// Helper class.
        static interface Predicate {
            abstract boolean test(Point p);
        }

        static abstract class UnaryFunction {
            abstract Point apply(Point p);
        }

    }

    static class Edge implements Comparable<Edge> {
        final Point a, b; // guarantee a < b
        Edge(Point x, Point y) {
            assert x != y;
            if (x.compareTo(y) > 0) { // y < x
                a = y; b = x;
            } else {
                a = x; b = y;
            }
        }

        public int compareTo(Edge e) {
            int x = a.compareTo(e.a);
            if (x != 0) return x;
            return b.compareTo(e.b);
        }
    }

    /// A graph consists of multiple {@code Point}s.
    static class Graph {
        private HashMap<Point, Point> points;

        public Graph() {
            points = new HashMap<Point, Point>();
        }

        public Graph(Graph g) {
            points = new HashMap<Point, Point>(g.points);
        }

        public void add(Point p, Point root) {
            assert(p.isPoint());
            assert(root.isPoint());
            assert(p == root || points.containsKey(root));
            points.put(p, root);
        }

        public Graph map(Point.UnaryFunction fn) {
            Graph result = new Graph();
            for (Map.Entry<Point, Point> pq : points.entrySet()) {
                Point p = pq.getKey(), q = pq.getValue();
                assert(p.isPoint()) : p;
                assert(q.isPoint()) : q;
                p = fn.apply(p); assert(p.isPoint()) : p;
                q = fn.apply(q); assert(q.isPoint()) : q;
                result.points.put(p, q);
            }
            return result;
        }

        public Graph reflectX() {
            return this.map(new Point.UnaryFunction() {
                public Point apply(Point p) {
                    return p.reflectX();
                }
            });
        }

        public Graph rot60() {
            return this.map(new Point.UnaryFunction() {
                public Point apply(Point p) {
                    return p.rot60();
                }
            });
        }

        @Override
        public boolean equals(Object o) {
            if (o == null) return false;
            if (o.getClass() != getClass()) return false;
            Graph g = (Graph) o;
            return points.equals(g.points);
        }

        @Override
        public int hashCode() {
            return points.hashCode();
        }

        Graph[] expand(Point.Predicate fn) {
            List<Graph> result = new ArrayList<Graph>();

            for (Point p : points.keySet()) {
                int[] deltaX = new int[] { -1, 0, 1, 1,  0, -1};
                int[] deltaY = new int[] {  0, 1, 1, 0, -1, -1};
                for (int i = 6; i --> 0;) {
                    Point p1 = new Point(p.x + deltaX[i], p.y + deltaY[i]);
                    if (points.containsKey(p1) || !fn.test(p1)
                        || !p1.isPoint()) continue;

                    Graph g = new Graph(this);
                    g.add(p1, p);
                    result.add(g);
                }
            }

            return result.toArray(new Graph[0]);
        }

        public static Graph[] expand(Graph[] graphs, Point.Predicate fn) {
            Set<Graph> result = new HashSet<Graph>();

            for (Graph g0 : graphs) {
                Graph[] g = g0.expand(fn);
                for (Graph g1 : g) {
                    if (result.contains(g1)) continue;
                    result.add(g1);
                }
            }

            return result.toArray(new Graph[0]);
        }

        private Edge[] edges() {
            List<Edge> result = new ArrayList<Edge>();
            for (Map.Entry<Point, Point> pq : points.entrySet()) {
                Point p = pq.getKey(), q = pq.getValue();
                if (p.equals(q)) continue;
                result.add(new Edge(p, q));
            }
            return result.toArray(new Edge[0]);
        }

        /**
         * Check if two graphs are isomorphic... under translation.
         * @return {@code true} if {@code this} is isomorphic
         * under translation, {@code false} otherwise.
         */
        public boolean isomorphic(Graph g) {
            if (points.size() != g.points.size()) return false;
            Edge[] a = this.edges();
            Edge[] b = g.edges();
            Arrays.sort(a);
            Arrays.sort(b);

            // for (Edge e : b)
                // System.err.println(e.a + " - " + e.b);
            // System.err.println("------- >><< ");

            assert (a.length > 0);
            assert (a.length == b.length);
            int a_bx = a[0].a.x - b[0].a.x, a_by = a[0].a.y - b[0].a.y;
            for (int i = 0; i < a.length; ++i) {
                if (a_bx != a[i].a.x - b[i].a.x || 
                    a_by != a[i].a.y - b[i].a.y) return false;
                if (a_bx != a[i].b.x - b[i].b.x || 
                    a_by != a[i].b.y - b[i].b.y) return false;
            }

            return true;
        }

        // C_{2v}.
        public boolean correctSymmetry() {

            Graph[] graphs = new Graph[6];
            graphs[0] = this.reflectX();
            for (int i = 1; i < 6; ++i) graphs[i] = graphs[i-1].rot60();
            assert(graphs[5].rot60().isomorphic(graphs[0]));
            int count = 0;
            for (Graph g : graphs) {
                if (this.isomorphic(g)) ++count;
                // if (count >= 2) {
                    // return false;
                // }
            }
            // if (count > 1) System.err.format("too much: %d%n", count);
            assert(count > 0);
            return count == 1; // which is, basically, true
        }

        public void reflectSelfType2() {
            Graph g = this.map(new Point.UnaryFunction() {
                public Point apply(Point p) {
                    return new Point(p.y - p.x, p.y);
                }
            });

            Point p = new Point(1, 1);
            assert (p.equals(points.get(p)));

            points.putAll(g.points);

            assert (p.equals(points.get(p)));
            Point q = new Point(0, 1);
            assert (q.equals(points.get(q)));
            points.put(p, q);
        }

        public void reflectSelfX() {
            Graph g = this.reflectX();
            points.putAll(g.points); // duplicates doesn't matter
        }

    }

    static int A936(int n) {
        // if (true) return (new int[]{0, 0, 0, 1, 1, 2, 4, 4, 12, 10, 29, 27, 88, 76, 247, 217, 722, 638, 2134, 1901, 6413})[n];

        // some unreachable codes here for testing.
        int ans = 0;

        if (n % 2 == 0) { // reflection type 2. (through line 2x == y)
            Graph[] graphs = new Graph[1];
            graphs[0] = new Graph();

            Point p = new Point(1, 1);
            graphs[0].add(p, p);

            for (int i = n / 2 - 1; i --> 0;)
                graphs = Graph.expand(graphs, new Point.Predicate() {
                    public boolean test(Point p) {
                        return 2*p.x > p.y;
                    }
                });

            int count = 0;
            for (Graph g : graphs) {
                g.reflectSelfType2();
                if (g.correctSymmetry()) {
                    ++count;

                    // for (Edge e : g.edges())
                        // System.err.println(e.a + " - " + e.b);
                    // System.err.println("------*");

                    }
                // else System.err.println("Failed");
            }

            assert (count%2 == 0);

            // System.err.println("A936(" + n + ") count = " + count + " -> " + (count/2));

            ans += count / 2;

        }

        // Reflection type 1. (reflectX)

        Graph[] graphs = new Graph[1];
        graphs[0] = new Graph();

        Point p = new Point(1, 0);
        graphs[0].add(p, p);

        if (n % 2 == 0) graphs[0].add(new Point(2, 0), p);

        for (int i = (n-1) / 2; i --> 0;)
            graphs = Graph.expand(graphs, new Point.Predicate() {
                public boolean test(Point p) {
                    return p.y > 0;
                }
            });

        int count = 0;
        for (Graph g : graphs) {
            g.reflectSelfX();
            if (g.correctSymmetry()) {
                ++count;
                // for (Edge e : g.edges())

                    // System.err.printf(

                // "pu %s pd %s\n"
                // // "%s - %s%n"

                // , e.a, e.b);
                // System.err.println("-------/");

            }
            // else System.err.println("Failed");
        }

        if(n % 2 == 0) {
            assert(count % 2 == 0);
            count /= 2;
        }
        ans += count;

        // System.err.println("A936(" + n + ") = " + ans);

        return ans;
    }

    public static void main(String[] args) {

        // Probably
        if (! "1.5.0_22".equals(System.getProperty("java.version"))) {
            System.err.println("Warning: Java version is not 1.5.0_22");
        }

        // A936(6);

        for (int i = 0; i < 20; ++i)
            System.out.println(i + " | " + (A63(i+9) - A936(i+7)));
        //A936(i+2);
    }
}

Try it online!


Side note:

  1. Tested locally with Java 5. (such that the warning is not printed - see TIO debug tab)
  2. Don't. Ever. Use. Java. 1. It's more verbose than Java in general.
  3. This may break the chain.
  4. The gap (7 days and 48 minutes) is no more than the gap created by this answer, which is 7 days and 1 hours 25 minutes later than the previous one.
  5. New record on large bytecount! Because I (mistakenly?) use spaces instead of tabs, the bytecount is larger than necessary. On my machine it's 9550 bytes. (at the time of writing this revision)
  6. Next sequence.
  7. The code, in its current form, only prints the first 20 terms of the sequence. However it's easy to change so that it will prints first 1000 items (by change the 20 in for (int i = 0; i < 20; ++i) to 1000)

Yay! This can compute more terms than listed on the OEIS page! (for the first time, for a challenge I need to use Java) unless OEIS has more terms somewhere...


Quick explanation

Explanation of the sequence description.

The sequence ask for the number of free nonplanar polyenoid with symmetry group C2v, where:

For example, consider the trees

      O                O           O      O       (3)
      |                 \         /        \
      |                  \       /          \
O --- O --- O             O --- O            O --- O
      |                                             \
      |                    (2)                       \
 (1)  O                                               O

The first one cannot be embedded in the hexagonal lattice, while the second one can. That particular embedding is considered different from the third tree.

(2) and (3) tree above are planar. This one, however, is nonplanar:

   O---O O
  /       \
 /         \
O           O
 \         /
  \       /
   O --- O

(there are 7 vertices and 6 edges)

For example, the only polyenoid with 2 vertices

O --- O

has 3 planes of reflection: The horizontal one -, the vertical one |, and the one parallel to the computer screen . That's too much.

On the other hand, this one

O --- O
       \
        \
         O

has 2 planes of reflection: / and .


Explanation of the method

And now, the approach on how to actually count the number.

First, I take the formula a(n) = A000063(n + 2) - A000936(n) (listed on the OEIS page) for granted. I didn't read the explanation in the paper.

[TODO fix this part]

Of course, counting planar is easier than counting nonplanar. That's what the paper does, too.

Geometrically planar polyenoids (without overlapping vertices) are enumerated by computer programming. Thus the numbers of geometrically nonplanar polyenoids become accessible.

So... the program counts the number of planar polyenoid, and subtract it from the total.

Because the tree is planar anyway, it obviously has the plane of reflection. So the condition boils down to "count number of tree with an axis of reflection in its 2D representation".

The naive way would be generate all trees with n nodes, and check for correct symmetry. However, because we only want to find the number of trees with an axis of reflection, we can just generate all possible half-tree on one half, mirror them through the axis, and then check for correct symmetry. Moreover, because the polyenoids generated are (planar) trees, it must touch the axis of reflection exactly once.

The function public static Graph[] expand(Graph[] graphs, Point.Predicate fn) takes an array of graphs, each have n nodes, and output an array of graph, each has n+1 nodes, not equal to each other (under translation) - such that the added node must satisfy the predicate fn.

Consider 2 possible axes of reflection: One that goes through an vertex and coincide with edges (x = 0), and one that is the perpendicular bisector of an edge (2x = y). We can take only one of them because the generated graphs are isomorphic, anyway.

So, for the first axis x = 0, we start from the base graph consists of a single node (1, 0) (in case n is odd) or two nodes with an edge between (1, 0) - (2, 0) (in case n is even), and then expand nodes such that y > 0. That's done by the "Reflection type 1" section of the program, and then for each generated graph, reflect (mirror) itself through the X axis x = 0 (g.reflectSelfX()), and then check if it has the correct symmetry.

However, note that if n is divisible by 2, by this way we counted each graph twice, because we also generate its mirror image by the axis 2x = y + 3.

(note the 2 orange ones)

Similar for the axis 2x = y, if (and only if) n is even, we start from the point (1, 1), generate graphs such that 2*x > y, and reflect each of them over the 2x = y axis (g.reflectSelfType2()), connect (1, 0) with (1, 1), and check if they have correct symmetry. Remember to divide by 2, too.

288. Swift 4, 186 bytes, A007437

func divisors(_ n: Int) -> [Int]{
	return Array(1...n).filter{n % $0 < 1}
}

func A007437(_ n: Int) -> Int{
	var summ = 0
	for i in divisors(n + 1){
		summ += i*(i+1)/2
	}
	return summ
}

Try it online!

Next Sequence: Number of 3 by n Latin rectangles in which the first row is in order.

287. Scratch 2, 7437 Bytes, A001118

A001118

Try it online

Here is the text version of the full program.

Below is the portion of the program that represents the code blocks in the image. The full text is much longer, dealing with things irrelevant to this challenge.

        "scripts": [[275.8,
                75.2,
                [["procDef", "Power %n %n", ["Base", "exponent"], [1, 1], false],
                    ["setVar:to:", "presult", "1"],
                    ["doRepeat",
                        ["getParam", "exponent", "r"],
                        [["setVar:to:", "presult", ["*", ["readVariable", "presult"], ["getParam", "Base", "r"]]]]]]],
            [539.1,
                73.2,
                [["procDef", "Binomial %n %n", ["a", "b"], [1, 1], false],
                    ["call", "FactLoop %n", ["getParam", "a", "r"]],
                    ["setVar:to:", "bin", ["readVariable", "result"]],
                    ["call", "FactLoop %n", ["getParam", "b", "r"]],
                    ["setVar:to:", "bin", ["\/", ["readVariable", "bin"], ["readVariable", "result"]]],
                    ["call", "FactLoop %n", ["-", ["getParam", "a", "r"], ["getParam", "b", "r"]]],
                    ["setVar:to:", "bin", ["\/", ["readVariable", "bin"], ["readVariable", "result"]]]]],
            [286.7,
                244,
                [["procDef", "FactLoop %n", ["n"], [1], false],
                    ["setVar:to:", "count", ["getParam", "n", "r"]],
                    ["setVar:to:", "result", "1"],
                    ["doUntil",
                        ["<", ["readVariable", "count"], "2"],
                        [["setVar:to:", "result", ["*", ["readVariable", "result"], ["readVariable", "count"]]],
                            ["changeVar:by:", "count", -1]]]]],
            [44,
                71,
                [["whenGreenFlag"],
                    ["doAsk", ""],
                    ["setVar:to:", "nseq", ["answer"]],
                    ["setVar:to:", "sum", 0],
                    ["setVar:to:", "i", 0],
                    ["doRepeat",
                        5,
                        [["call", "Power %n %n", -1, ["readVariable", "i"]],
                            ["setVar:to:", "term", ["readVariable", "presult"]],
                            ["call", "Power %n %n", ["-", 5, ["readVariable", "i"]], ["readVariable", "nseq"]],
                            ["setVar:to:", "term", ["*", ["readVariable", "term"], ["readVariable", "presult"]]],
                            ["call", "Binomial %n %n", 5, ["readVariable", "i"]],
                            ["setVar:to:", "term", ["*", ["readVariable", "term"], ["readVariable", "bin"]]],
                            ["changeVar:by:", "sum", ["readVariable", "term"]],
                            ["changeVar:by:", "i", 1]]],
                    ["say:", ["readVariable", "sum"]]]]],

Next Sequence: Inverse Moebius transformation of triangular numbers

286. Pyon, 1118 bytes, A000151

from fractions import Fraction

def tofrac(a):
	global Fraction
	return [Fraction(x) for x in a]

# a(x)*b(x), first n terms
def mul(a, b, n):
	x=[0] * min(n, len(a) + len(b) - 1)
	for i in range(min(n, len(a))):
		for j in range(min(n - i, len(b))):
			x[i + j] += a[i] * b[j]
	return x

# a(x^e), first n terms
def powarg(a, e, n):
	return [0 if i % e else a[i // e] for i in range(n)]

# c*a(x)
def mulc(a,c):
	return [x * c for x in a]

def divcfrac(a,c):
	return [x / c for x in a]

# a(x) + b(x)
def add(a,b):
	return [(a[i] if i < len(a) else 0) + (b[i] if i < len(b) else 0) for i in range(max(len(a), len(b)))]

# a'(x)
def polyderiv(a):
	return [i * x for i, x in enumerate(a)][1:]

# f(x)*exp(g(x)), coefficient of x^n
def exptaylor(f,g,n):
	global add, polyderiv, mul
	fac = 1
	for i in range(n):
		f=add(polyderiv(f), mul(f, polyderiv(g), n))
		fac *= i + 1
	return f[0].numerator // fac

R = [0, 1]

for n in range(len(R), int(input()) + 2):
	P = []
	for k in range(1, n):
		d = divcfrac([Fraction(x) for x in powarg(R, k, n)], k)
		P = add(P, d)
	R.append(exptaylor([0, 1], mulc(P, 2), n))

print(R[-1])

Try it online!

Next sequence!

282. Actually, 126 bytes, A011628

29*7+9*8+╝╛@%╗╜0=⌠00.ó⌡n10-1╛R⌠²╛@%╜=⌡cI"Did you know that Vim is vastly superior to every other existing editor? #flamewars"X

Try it online!

Next sequence!

Explanation

29*7+9*8+╝╛@%╗╜0=⌠00.ó⌡n10-1╛R⌠²╛@%╜=⌡cI
29*7+9*8+╝                               Put 233 in the second register
          ╛@%╗                           Calculate input%233 and put it in the
                                         first register (I'll call this n)
              ╜0=⌠00.ó⌡n                 If n is 0, output 0 and exit
                            ╛R⌠      ⌡c  Count integers smaller or equal to 233...
                               ²         such that their squares
                                ╛@%      are congruent modulo 233
                                   ╜=    to the input.
                                       I If there is at least one such integer
                                         (i. e. n is a quadratic residue mod 233)
                           1             then output 1,
                        10-              otherwise, output -1

284. Hexagony, 211 bytes, A000384

     ? } 2 \ . .
    . . . " . . .
   . @ ! * = < . .
  . . . > ( { / . .
 . . . . . . . . . .
. . . . . . . . . . .
 . . . . . . . . . .
  . . . . . . . . .
   . . . . . . . .
    . . . . . . .
     . . . . . .

Try it online!

Next sequence!

What better language is there to compute hexagonal numbers?

Explanation

I decided to make this code use each character (except ., space and newline) only once, because I had too much time on my hands. Let's label the edge the MP starts on A, the one to the left of it L and the one to the right - R. The following linear code gets executed:

?}2"*({=*!@
?           A = input()
 }2         R = 2
   "*       L = A * R = 2 * n
     (      L = L - 1 = 2 * n - 1
      {=*   R = A * L = n(2n-1) = a(n)
         !  Print the result
          @ End execution

265. brainfuck, 636 Bytes, A000102

[-]>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<

<<<<<+<++<+++++>>>>>>>

[
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]
<[-<<<<<<<+>>>>>>>]

<<<<<<<
[>>>>>>>++ >+< <<<<<<<-]
>[>>>>>>+ >>+<< <<<<<<-]
>[>>>>> >>>+<<< <<<<<-]
>[>>>>-- >>>>+<<<< <<<<-]
>[>>>--- >>>>>+<<<<< <<<-]
>[>>-- >>>>>>+<<<<<< <<-]
>[>-<-]

>>>>>>>>-]

<<[-]<[-]<[-]<[-]<[-]<[-]>>>>>>

[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]
  ++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<

Input is a normal decimal number.

Note that the result is calculated modulo the cell size, so for TIO 256, but it works for other cell sizes as well.

Try it online!


Explanation:

Relies on the recursive definition a(n) = 2*a(n-1) + a(n-2) - 2*a(n-4) - 3*a(n-5) - 2*a(n-6) - a(n-7)

[-]>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<

takes input (decimal value in ASCII) and write actual decimal number in a cell. Taken from the esolang site listing BF algorithms.

<<<<<+<++<+++++>>>>>>> 

initialize first seven values (0, 0, 0, 0, 1, 2, 5)

Then comes the main block. Basically the seven cells to the left of the input represent a(n) a(n-1) a(n-2) a(n-3) a(n-4) a(n-5) a(n-6) and the input represents how many 'window shifting' operations have to be performed still, where a window shifting operation consists of a(n-6)=a(n-5), a(n-5)=a(n-4) etc. and the calculation of the new a(n)(so a(n+1) in terms of our old labels) as described above. The former (a-6) is dropped.

<[-<<<<<<<+>>>>>>>]

Move a value seven cells left, do this for all sequence terms. Then we move to the former a(n) with value x and execute

[>>>>>>>++ >+< <<<<<<<-]

which increases the new value of a(n) by 2*x and the value of a(n-1) by x. Repeat the same for the other sequence values with the corresponding factor for a(n).

Finally, move back to the input, decrease it by 1. If input is zero, we're done with the main block. If not, execute another window shift operation.

<<[-]<[-]<[-]<[-]<[-]<[-]>>>>>>

Zero all the sequence numbers not required for the final output. (This is not necessary, but I like to do it anyway to make sure it does not interfere with the output function.

[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]
  ++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<

Lastly, output the number left to the input which started as a(0), so it is a(n)after n window shifts. The algorithm for this is again taken from the esolangs site linked above.


This window shifting algorithm is generally quite efficient, but this implementation can be optimized a lot.

For some input n, we do n window shifts, but after that our lowest stored value is a(n), which means we already calculated a(n+6). This is obviously inefficient but saves the special handling required for inputs <7, so it saves some characters and mainly nerves of the programmer.

Second, it is not necessary to copy the whole sequence. It'd be sufficient to copy one value, but this way it's more convenient to write and understand.

Here is a solution implementing the second optimization. Only the old a(n) is moved. The other values move one spot to the right and their corresponding multiple is added/subtracted in one loop. This actually saves more time then I expected for larger values with unbounded cell size.


Next sequence: A000636

11. Pari/GP, 64 bytes, A000065

{a(n) = if( n<0, 0, polcoeff ( 1 / eta(x + x*O(x^n) ), n) - 1)};

Try it online!

Next sequence

285. Squirrel, 151 bytes, A000211

function A000211(input) {
if(input==0){
return 4;
}
if(input==1){
return 3;
}
if(input==2){
return 5;
}
return (A000211(input-1)+A000211(input-2)-2);
}

Try it online!

Didn't take much to learn this language!

Next Sequence!

283. Ohm v2, 384 bytes, A000126

³4+ý³-2-                                                                                                                                                                                                                                                                                                                                                                                        

Try it online!

Next Sequence. (This one is trivial, the hexagonal numbers!)

If this were code golf, I could solve this in 6 bytes: 4+ýa‹‹.

This one was really just Fibonacci(N + 4) - N - 2.

81. Röda, 290 bytes, A000140

fact n {
  b = 2
  x = 0
  while [ n > 0 ] do
    x += n % b
    n = floor(n / b)
    b += 1
  done
  return x
}

A000140 n {
  x = 1; q = n; while [ q > 0 ] do x *= q; q -= 1; done
  t = 0
  while [ x > 0 ] do
    x -= 1
    t += 1 if [ fact(x) = floor(n * (n-1) / 4) ]
  done
  return t
}

Try it online!

Next sequence

Each item in A000140 is the largest number of permutations of a length-n array all having the same inversion count. This may sound daunting, but it's really not. Here's the table of possible inversions for n = 3:

    [inv. table]  [permutation]  inversion count
0:     [ 0 0 ]      [ 0 1 2 ]    0
1:     [ 1 0 ]      [ 1 0 2 ]    1
2:     [ 0 1 ]      [ 0 2 1 ]    1
3:     [ 1 1 ]      [ 2 0 1 ]    2
4:     [ 0 2 ]      [ 1 2 0 ]    2
5:     [ 1 2 ]      [ 2 1 0 ]    3

1 permutation has zero inversions, 2 permutations have one inversion each, 2 others have two inversions each, and 1 has three. The maximal number of permutations with x inversions is 2, shared by x = 1 and x = 2, so the output is 2.

Now don't get concerned; we don't have to calculate all permutations of a length-n array. You may have noticed that each inversion table (in the second-to-left column) sums to the number of inversions of that permutation. Also, it turns out calculating the sum of the inversion table for a permutation index k is remarkably simple: just convert k to the factorial base and sum the digits. Examples:

 k: [fact. digits]  sum
 0: [          0 ]  0
 1: [          1 ]  1
 2: [        1 0 ]  1
 3: [        1 1 ]  2
 4: [        2 0 ]  2
 5: [        2 1 ]  3
 6: [      1 0 0 ]  1
 7: [      1 0 1 ]  2
 8: [      1 1 0 ]  2
...
22: [      3 2 0 ]  5
23: [      3 2 1 ]  6
24: [    1 0 0 0 ]  1
25: [    1 0 0 1 ]  2
...

This sequence itself is A034968. So to calculate the n-th term in A000140, all you have to do is find the x that appears the most often in the first n! terms of the factorial digit sum sequence, then return how many times x appears. And you don't even have to find x manually: the OEIS page mentions that it's always floor(n(n-1)/4).

After I made all of these realizations, implementing it was a piece of cake. The hardest part was learning how Röda itself works, but that was a fun challenge in itself. Thanks @fergusq for the nice language :-)

280. Axiom, 947 bytes, A002852

artanh:(Float) -> Float
artanh(x) == 
    y := x 
    k := 1
    for k in 1..precision() repeat
        z := x^(2*k+1) / (2 * k + 1)
        y := z + y
    return y

ln2:() -> Float
ln2() == artanh(0.5) + artanh(1.0 / 7)

gamma:(NonNegativeInteger) -> Float
gamma(e) ==
    precision(2 ^ e + 100)
    n := 2.0 ^ e
    eps := 1.0 / n
    A := - e * ln2()
    B := 1.0
    U := A 
    V := 1.0
    k := 1
    repeat
        B := B * n^2 / k^2
        A := (A * n^2 / k + B) / k
        if (A < eps) /\ (B < eps) then
            return U / V
        U := U + A
        V := V + B
        k := k + 1

fractions:(NonNegativeInteger, Integer) -> List(Integer)
fractions(e, n) ==
    y := gamma(e)
    l : List(Integer) := []
    for i in 0..n repeat
        f := floor(y)
        l := cons(f, l)
        y := y - f
        if y > 0 then 
            y := 1 / y
    reverse(l)

)set messages prompt none
)set messages type off
fractions(12, 1000)
)quit

next sequence

There doesn't seem to be a good way to read input in this system, but called like this (using the fricas fork)

fricas -noht -eval ")read em.input )quiet" 

where em.input contains the source code, will print a table of the first 1001 elements of the sequence.

279. Fortran (GFortran), 2852 bytes, A005692

program beans

integer :: n, first_move, last_move, new_move1, new_move2, turn_count, win_accomplished, cycleq

integer, dimension(270,1000000) :: current_paths, next_paths
integer :: next_path_count, current_path_count, path_iter, move_iter, cycle_iter

read *,n
first_move = 2*n+1
turn_count = 0
win_accomplished = 0


current_paths(1,1)=first_move
current_path_count=1


do while(.true.)
  
  turn_count = turn_count + 1    !current path length

  if (first_move == 1) then
    turn_count = 1
    exit
  end if

  next_path_count = 1


  do path_iter=1,current_path_count
    
    cycleq = 0
    last_move = current_paths(turn_count,path_iter)
    !print *,'prince'
    !print *,last_move
    !print *,'prince'

  
    if (mod(last_move,2)==1)  then
      if (last_move>1) then
        if (mod(turn_count,2) == 0) then
          cycle
        end if
      end if
    end if

    if (last_move==1) then
      if (mod(turn_count,2) == 0) then
        win_accomplished = 1
      end if

    else if (mod(last_move,2)==0) then
      new_move1 = last_move/2

      do cycle_iter = 1,turn_count
        if (current_paths(cycle_iter,path_iter) == new_move1) then
          cycleq=1
        end if
      end do

      if (cycleq == 0) then
        do cycle_iter=1,turn_count
          next_paths(cycle_iter,next_path_count) = current_paths(cycle_iter,path_iter)
        end do 
        next_paths(turn_count+1,next_path_count) = new_move1
        next_path_count = next_path_count + 1
      end if

    else 
      new_move1 = 3*last_move + 1
      new_move2 = 3*last_move - 1

      cycleq=0
      do cycle_iter = 1,turn_count
        if (current_paths(cycle_iter,path_iter) == new_move1) then
          cycleq=1
        end if
      end do 

      if (cycleq == 0) then
        do cycle_iter=1,turn_count
          next_paths(cycle_iter,next_path_count) = current_paths(cycle_iter,path_iter)
        end do 
        next_paths(turn_count+1,next_path_count) = new_move1
        next_path_count = next_path_count + 1
      end if


      cycleq=0
      do cycle_iter = 1,turn_count
        if (current_paths(cycle_iter,path_iter) == new_move2) then
          cycleq=1
        end if
      end do 

      if (cycleq == 0) then
        do cycle_iter=1,turn_count
          next_paths(cycle_iter,next_path_count) = current_paths(cycle_iter,path_iter)
        end do
        next_paths(turn_count+1,next_path_count) = new_move2
        next_path_count = next_path_count + 1
      end if

    end if

  end do 

  if (win_accomplished==1) then
     exit
  end if


  do path_iter=1,next_path_count-1
    do move_iter=1,turn_count+1
      current_paths(move_iter,path_iter) = next_paths(move_iter,path_iter)
      next_paths(move_iter,path_iter) = 0
    end do
  end do
  
  current_path_count = next_path_count-1

end do


print *,turn_count-1

end program beans

Try it online!

Next Sequence

I originally wrote a similar program in Python. It properly compiled in Pyon but I wanted to see if I could write it in Fortran first and save Pyon/Python for harder sequences.

The program relies on the fact that if Jack moves to an odd number then the Giant gains control and will be able to use a never-lose strategy. It starts with a the Giant's fist move [n] then enumerates all the possible games until the first win is found which must be the shortest one since moves are added to each possible game pathway once per iteration of the main loop. If Jack loses in one particular game or if the Giant takes control then that particular game pathway is abandoned which helps save on memory and time.

The first term in the sequence doesn't make any sense to me since it isn't a win for Jack but I hard coded it in anyway.

The paper OEIS references helped me understand the sequence. They suggest an algorithm to us on a computer (they calculated the first 525 terms of the sequence by hand) which I didn't use because it seemed a little more difficult to implement but it would probably be faster and much less memory intensive.

Because of memory limitations, the program won't actually work on all the terms but is fine for terms up to at least 119 (n=109). Note that the two arrays declared at the top have 270x10^6 elements. This allows in the algorithm for 10^6 branches of possible game paths of length 270 moves. None of the first 1000 terms are bigger than 263 so this is still valid for the challenge.

The next sequence (terms in the continued fraction of Eulers constant) looks pretty hard, but maybe that's just because I don't know how to do it of the top of my head. I promise I didn't engineer my byte-count to pick this, it's just what I ended up with.

Edit: It seems calculating the terms doesn't seem too hard once you have the actual constant (which is irrational [edit: apparently this is actually not known]). Here are some resources:

271. Java 6, 10008 bytes, A000103

This program was written entirely by user202729. I am posting this with the creator's explicit permission / request.

/*
Edit: Why must I map from Edge to index, 
and then get edge from index, 
while I can map Edge to Edge? Fixed.
--------
Edit 2: Remove some dependency on ArrayList.get.
--------
Edit 3: Remove a factor of n! because I didn't think
about this efficient graph isomorphism checking.
---------
Ok... the solution turns out to be too short now to
get to 10008 bytes. Therefore I'm going to add some
random things here.

#############################################
#############################################
#############################################
#############################################
#############################################
#############################################
#############################################
#############################################
*/

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.IdentityHashMap;
import java.util.Scanner;

public class Main {
	
	static class Edge {
		Edge next, prev, twin;
		final int node;
		Edge(int node) {
			this.node = node;
		}
		Edge pairNext(Edge e) {
			this.next = e; e.prev = this;
			return this;
		}
		Edge pairTwin(Edge e) {
			this.twin = e; e.twin = this;
			return this;
		}
	}
	
	static class Graph {
		List<Edge> edges;
		int nVertices;
		
		/** 
		 * Initialize to a tetrahedral graph.
		 */
		Graph () {
			nVertices = 3;
			
			edges = new ArrayList<Edge>();
			
			edges.add(new Edge(0));
			edges.add(new Edge(1));
			edges.add(new Edge(2));
			edges.get(0).pairNext(edges.get(1));
			edges.get(1).pairNext(edges.get(2));
			edges.get(2).pairNext(edges.get(0));
			
			edges.add(new Edge(1));
			edges.add(new Edge(2));
			edges.add(new Edge(0));
			edges.get(3).pairTwin(edges.get(0)).pairNext(edges.get(5));
			edges.get(4).pairTwin(edges.get(1)).pairNext(edges.get(3));
			edges.get(5).pairTwin(edges.get(2)).pairNext(edges.get(4));
			
			addVertex(new Edge[] {
				edges.get(0), edges.get(1), edges.get(2)
			});
		}
		
		/** 
		 * Copy the other graph.
		 * Expected time complexity O(n) where n is the number of edges
		 * in the graph.
		 * @param other The other graph.
		 */
		Graph (Graph other) {
			nVertices = other.nVertices;
			edges = new ArrayList<Edge>(other.edges.size()); // initial capacity
			Map<Edge, Edge> map = new IdentityHashMap<Edge, Edge>();
			for (Edge e : other.edges) {
				Edge f = new Edge(e.node);
				edges.add(f);
				map.put(e, f);
			}

			assert other.edges.size() == edges.size();

			for (Map.Entry<Edge, Edge> ef : map.entrySet()) {
				Edge e = ef.getKey(), f = ef.getValue();
				f.prev = map.get(e.prev);
				f.next = map.get(e.next);
				f.twin = map.get(e.twin);
			}
		}
		
		/**
		 * Find circuit from one edge.
		 * Note that if the circuit length is less than {@code n}, {@code null}
		 * is also returned.
		 * @param e The input edge.
		 * @return An edge array of length {@code n} consists of node indices, 
		 * or {@code null} if not found.
		 */
		Edge[] findCircuit (Edge e, int n) {
			
			assert edges.contains(e);
			
			Edge[] circuitEdges = new Edge[n];
			circuitEdges[0] = e;
			for (int i = 1; i < n; ++i) {
				circuitEdges[i] = circuitEdges[i-1].next;
				
				assert circuitEdges[i].prev == circuitEdges[i-1];
			}
			return circuitEdges[n - 1].next == e ? circuitEdges : null;
		}
		
		/**
		 * Add an vertex to the plane bounded by {@code circuit}. <br>
		 * The vertex will be connected to all of the vertices inside the 
		 * circuit. <br>
		 * Time complexity: O({@code circuit.length}).
		 * @param circuit The specified plane. Should be listed in the order
		 * such that {@code circuit[i].next == circuit[(i+1) % nVertices]}
		 * for all valid {@code i}.
		 */
		void addVertex(Edge[] circuit) {
			int n = edges.size(), k = circuit.length;
			
			for (int i = 0; i < k; ++i) {
				assert(circuit[i].next == circuit[(i+1)%k]);
				assert(circuit[(i+1)%k].prev == circuit[i]);
			}
			
			for (int i = 0; i < k; ++i) edges.add(
					new Edge(nVertices)
					.pairNext(circuit[i])
			);
			for (int i = 0; i < k; ++i) edges.add(
					new Edge(circuit[i].node)
					.pairTwin(edges.get(n + i))
					.pairNext(edges.get(n + (i == 0 ? k : i) - 1))
			);
			for (int i = 0; i < k; ++i) 
				circuit[i].pairNext(edges.get(n + (i == k-1 ? i : i + k) + 1));
			
			++nVertices;
		}
		
		/**
		 * Remove an edge from the graph. <br>
		 * Time complexity O({@code edges.size()}).
		 * @param edge The edge to remove.
		 */
		void removeEdge(Edge edge) {

			assert edges.contains(edge);
			
			Edge twin = edge.twin;
			twin.prev.pairNext(edge.next);
			edge.prev.pairNext(twin.next);
			
			// it is possible to implement this in O(1) with LinkedList but I'm lazy...
			boolean success = edges.remove(edge);
			success = edges.remove(twin) && success; 
			assert success;
			
		}
		
		/**
		 * Calculate the minimum degree of any vertex.
		 * @return The minimum degree of any vertex.
		 */
		int minVertexDegree() {
			int[] degree = new int[nVertices];
			for (Edge e : edges) ++degree[e.node];
			
			int ans = degree[0];
			for (int d : degree)
				if (d < ans) ans = d;
			
			return ans;
		}
		
		/**
		 * Check isomorphism between two graphs (reflection does not count).
		 * @param g Other graph.
		 * @return whether the graphs are isomorphic under rotation.
		 */
		boolean isomorphicToWithoutReflection(Graph g) {
			check_edge_equivalence:
			for (Edge e : edges) {
				Map<Edge, Edge> map = new IdentityHashMap<Edge, Edge>();
				map.put(e, g.edges.get(0));
				
				/**
				 * List containing edges which are mapped, but their neighbors 
				 * ({@code next, prev, twin} are not mapped.
				 */
				List<Edge> pending = new ArrayList<Edge>(); 
				pending.add(e);
				
				while (!pending.isEmpty()) {
					Edge f = pending.remove(pending.size() - 1), map_f = map.get(f);
					for (Edge[] adj : new Edge[][]{
						{f.next, map_f.next},
						{f.prev, map_f.prev},
						{f.twin, map_f.twin}
					}) {
						Edge map_adj = map.get(adj[0]);
						if (map_adj == null) {
							map.put(adj[0], adj[1]);
							pending.add(adj[0]);
						} else {
							if (map_adj != adj[1]) 
								continue check_edge_equivalence;
						}
					}
				}
				
				assert map.size() == edges.size(); // the graph is connected
				return true;
			}
			return false;
		}
		
		/**
		 * Reflect this graph.
		 */
		void reflect() {
			for (Edge e : edges) {
				Edge f = e.prev; e.prev = e.next; e.next = f;
			}
		}

		/**
		 * Check isomorphism between two graphs.
		 * Algorithmic complexity: O(n<sup>2</sup>).
		 * @param g The graph to check isomorphism with {@code this}.
		 * @return {@code true} if the graphs are isomorphic,
		 * {@code false} otherwise.
		 */
		boolean isomorphicTo(Graph g) {
			boolean ans = false;
			for (int i = 0; i < 2; ++i) {
				ans = ans || isomorphicToWithoutReflection(g);
				reflect();
			}
			return ans;
		}
	}
	
	/**
	 * Given a graph with length {@code n}, generate all graphs with length 
	 * {@code n+1} using the approach in MishaLavrov's answer to 
	 * HyperNeutrino's question on Math.SE about A000109
	 * @param graph The input graph.
	 * @return A List of graphs.
	 */
	static List<Graph> generateGraph(Graph graph) {
		ArrayList<Graph> result = new ArrayList<Graph>();
		
		// case 1: add vertex to list of 3 edges
		for (int i = 0; i < graph.edges.size(); ++i) {
			Edge edge = graph.edges.get(i);
			
			if (!(edge.node < edge.next.node && edge.node < edge.prev.node))
				continue; // avoid redundancy, for each triangular face 
			// only consider the edge with minimum node index
			
			Graph newgraph = new Graph(graph);
			edge = newgraph.edges.get(i);

			Edge[] circuit = newgraph.findCircuit(edge, 3);
			assert circuit != null; // the graph is supposed to be triangular 
			// decomposition of a sphere.
			
			newgraph.addVertex(circuit);
			result.add(newgraph);
			
		}
		
		// case 2: add vertex to 2 adjacent triangular faces
		for (int i = 0; i < graph.edges.size(); ++i) {
			Edge edge = graph.edges.get(i);

			Edge twin = edge.twin;
			if (edge.node > twin.node) continue;
			
			assert graph.findCircuit(edge, 3) != null;
			assert graph.findCircuit(twin, 3) != null;
			

			Graph newgraph = new Graph(graph);
			edge = newgraph.edges.get(i);

			Edge next = edge.next;
			newgraph.removeEdge(edge);
			Edge[] circuit = newgraph.findCircuit(next, 4);
			assert(circuit != null);
			newgraph.addVertex(circuit);

			result.add(newgraph);
		}
		
		// case 3: add vertex to 3 adjacent triangular faces
		for (int i = 0; i < graph.edges.size(); ++i) {

			Edge edge = graph.edges.get(i);
			if (edge.twin.next.twin == edge.prev.twin.prev) continue;
			
			Graph newgraph = new Graph(graph);

			edge = newgraph.edges.get(i);
			Edge next = edge.next, prev = edge.prev;
			assert newgraph.findCircuit(edge, 3) != null;
			
			newgraph.removeEdge(edge); newgraph.removeEdge(prev); 
			Edge[] circuit = newgraph.findCircuit(next, 5);
			assert(circuit != null);
			newgraph.addVertex(circuit);

			result.add(newgraph);
			
		}
		
		return result;
	}
	
	/**
	 * Evolve the graphs with number of node {@code n} to get graphs with 
	 * number of node {@code n+1}.
	 * @param graphs The list of graphs with {@code n} nodes.
	 * @return A list of graphs with {@code n+1} nodes.
	 */
	static List<Graph> evolve(List<Graph> graphs) {
		List<Graph> result = new ArrayList<Graph>();
		
		for (Graph graph : graphs) {
			outer: for (Graph g0 : generateGraph(graph)) {
				
				assert(g0.nVertices == graph.nVertices + 1);
				
				for (Graph g1 : result) {
					if (g0.isomorphicTo(g1))
						continue outer;
				}
				result.add(new Graph(g0));
			}
		}
		
		return result;
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		
		List<Graph> graphs = new ArrayList<Graph>();
		graphs.add(new Graph());
		
		for (int i = 0; i < n; ++i) graphs = evolve(graphs);
		
		int ans = 0;
		for (Graph g : graphs) {
			if (g.minVertexDegree() >= 4) ++ans;
		}
		
		System.out.println(ans);
	}
}

Try it online!

Note: TIO runs the program on Java 9, but I've tested running the program on Java 6u45 - Windows 32 bit locally, and it also works. Input 5 gives output 5 in about 21 seconds now, and input 6 gives output 12 in 7 minutes 14 seconds.

Next Sequence

232. Funky, 326 330 332 bytes, A000938

function gcd (a, b) {
    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    };
    return a;
}

function A000938 (n) {
    n = n + 2;
    ans = 0;
    for (m = 2; m <= n; ++m) {
        for (k = 2; k <= n; ++k) {
            ans = ans + (((n - k) + 1) * ((n - m) + 1) * gcd(k - 1, m - 1));
        }
    }
    ans = (2 * ans) - (
        (n*n) *
        ((n*n)-1) / 6
    );
    return ans;
}

Try it online!

Polyglot with Javascript. Try it online!

Next sequence.


Use the formula on the OEIS page for O(n^2 log n) complexity, instead of the naive O(n^6).

Quick explanation:


Some polyglot notes:

278. Java 6, 5692 bytes, A000104

import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;

final class Main {
	static final Set<Pair> offsets;

	static {
		offsets = new HashSet<Pair>();
		offsets.add(new Pair(0, +1));
		offsets.add(new Pair(0, -1));
		offsets.add(new Pair(+1, 0));
		offsets.add(new Pair(-1, 0));
	}

	static final class Pair {
		final int x, y;

		Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return "(" + this.x + ", " + this.y + ")";
		}

		public boolean equals(Object other) {
			if (other == null) {
				return false;
			} else if (other instanceof Pair) {
				Pair pair = (Pair) other;
				return this.x == pair.x && this.y == pair.y;
			} else {
				return false;
			}
		}

		public int hashCode() {
			return this.x ^ this.y; // Expect many collisions with this hashcode; it's mostly just to make sure the hashset actually checks for equality) //
		}

		public Pair add(Pair pair) {
			return new Pair(this.x + pair.x, this.y + pair.y);
		}
	}

	private Main() {}

	public static Set<Pair> rotate(Set<Pair> polyomino) {
		Set<Pair> result = new HashSet<Pair>();
		for (Pair pair : polyomino)
			result.add(new Pair(-pair.y, pair.x));
		return result;
	}

	public static Set<Pair> conjugate(Set<Pair> polyomino) {
		Set<Pair> result = new HashSet<Pair>();
		for (Pair pair : polyomino)
			result.add(new Pair(pair.x, -pair.y));
		return result;
	}

	public static List<Set<Pair>> variants(Set<Pair> polyomino) {
		List<Set<Pair>> results = new ArrayList<Set<Pair>>();
		for (int x = 0; x < 4; x++) {
			polyomino = rotate(polyomino);
			results.add(polyomino);
			results.add(conjugate(polyomino));
		}
		return results;
	}

	public static Set<Integer> x(Set<Pair> polyomino) {
		Set<Integer> results = new HashSet<Integer>();
		for (Pair pair : polyomino)
			results.add(pair.x);
		return results;
	}

	public static Set<Integer> y(Set<Pair> polyomino) {
		Set<Integer> results = new HashSet<Integer>();
		for (Pair pair : polyomino)
			results.add(pair.y);
		return results;
	}

	public static int max(Set<Integer> set) {
		if (set.size() == 0) throw new IllegalArgumentException("max arg is an empty sequence");
		Iterator<Integer> iterator = set.iterator();
		int max = iterator.next();
		while (iterator.hasNext()) {
			int value = iterator.next();
			max = max > value ? max : value;
		}
		return max;
	}

	public static int min(Set<Integer> set) {
		if (set.size() == 0) throw new IllegalArgumentException("min arg is an empty sequence");
		Iterator<Integer> iterator = set.iterator();
		int min = iterator.next();
		while (iterator.hasNext()) {
			int value = iterator.next();
			min = min < value ? min : value;
		}
		return min;
	}

	public static Pair corner(Set<Pair> polyomino) {
		return new Pair(min(x(polyomino)), min(y(polyomino)));
	}

	public static Set<Pair> normalize(Set<Pair> polyomino) {
		Pair cn = corner(polyomino);
		Set<Pair> results = new HashSet<Pair>();
		for (Pair pair : polyomino)
			results.add(new Pair(pair.x - cn.x, pair.y - cn.y));
		return results;
	}

	public static boolean translations(Set<Pair> p1, Set<Pair> p2) {
		return normalize(p1).equals(normalize(p2));
	}

	public static boolean isomorphic(Set<Pair> p1, Set<Pair> p2) {
		for (Set<Pair> p : variants(p1))
			if (translations(p, p2))
				return true;
		return false;
	}

	public static boolean filled(Set<Pair> polyomino) {
		Set<Integer> x = x(polyomino);
		Set<Integer> y = y(polyomino);
		for (int i = min(x) + 1; i < max(x); i++) {
			for (int j = min(y) + 1; j < max(y); j++) {
				if (!polyomino.contains(new Pair(i, j))
				&&   polyomino.contains(new Pair(i, j + 1))
				&&   polyomino.contains(new Pair(i, j - 1))
				&&   polyomino.contains(new Pair(i + 1, j))
				&&   polyomino.contains(new Pair(i - 1, j)))
					return false;
			}
		}
		return true;
	}

	public static List<Set<Pair>> polyominoes(int cells) {
		List<Set<Pair>> results = new ArrayList<Set<Pair>>();
		if (cells == 0) {
			results.add(new HashSet<Pair>());
			return results;
		} else if (cells == 1) {
			Set<Pair> set = new HashSet<Pair>();
			set.add(new Pair(0, 0));
			results.add(set);
			return results;
		} else if (cells == 2) {
			Set<Pair> set = new HashSet<Pair>();
			set.add(new Pair(0, 0));
			set.add(new Pair(0, 1));
			results.add(set);
			return results;
		} else {
			for (Set<Pair> polyomino : polyominoes(cells - 1)) {
				for (Pair cell : polyomino) {
					for (Pair offset : offsets) {
						Set<Pair> variant = new HashSet<Pair>(polyomino);
						variant.add(cell.add(offset));
						if (variant.size() == cells) {
							results.add(variant);
						}
					}
				}
			}
		}
		List<Set<Pair>> output = new ArrayList<Set<Pair>>();
		outer: for (Set<Pair> r : results) {
			for (Set<Pair> p : output) {
				if (isomorphic(r, p)) {
					continue outer;
				}
			}
			if (filled(r)) output.add(r);
		}
		return output;
	}

	public static void main(String[] args) {
		boolean visualizer = true; // Change to `false` to not show visualizations
		int cells;
		List<Set<Pair>> polyominoes = polyominoes(cells = new Scanner(System.in).nextInt());
		System.out.println(polyominoes.size());
		if (cells != 0 && visualizer) {
			System.out.println();
			for (Set<Pair> polyomino : polyominoes) {
				Set<Integer> x = x(polyomino);
				Set<Integer> y = y(polyomino);
				int minx = min(x), maxx = max(x);
				int miny = min(y), maxy = max(y);
				for (int i = minx; i <= maxx; i++) {
					for (int j = miny; j <= maxy; j++) {
						System.out.print(polyomino.contains(new Pair(i, j)) ? '#' : '.');
					} System.out.println();
				} System.out.println();
			}
		}
	}
}

Try it online!

The TIO link links to the Java 8 interpreter but this answer works on Java 6 (tested locally thanks to user202729).

Next Sequence - this one has enough terms to be hardcoded but please don't.

Originally programmed in Python

194. ALGOL 68 (Genie), 589 bytes, A000160

BEGIN
  LONG LONG INT n   := read int + 4;
  LONG LONG INT r   := 0;
  LONG LONG REAL ma := ( n / 4.0 ) ** 1.5;
  LONG LONG REAL mb := ( n / 3.0 ) ** 1.5;
  LONG LONG REAL mc := ( n / 2.0 ) ** 1.5;
  LONG LONG REAL x  := 2.0 / 3;
  INT a             := 1;
  WHILE a <= ma DO
    INT b := a;
    WHILE b <= mb DO
      INT c := b;
      WHILE c <= mc DO
        INT d := c;
        WHILE a ** x + b ** x + c ** x + d ** x <= n DO
          r := r + 1;
          d := d + 1
        OD;
        c := c + 1
      OD;
      b := b + 1
    OD;
    a := a + 1
  OD;
  print ( whole ( r , 0 ))
END

Try it online!

Next Sequence.

Based on the comments of the sequence, counts the solutions to the inequality

a(2/3)+b(2/3)+c(2/3)+d(2/3) ≤ n

for any four integers 1 ≤ a ≤ b ≤ c ≤ d.

I also gave a fairly straightforward next sequence, to make up for last time.

Edit: This was originally written for Java 8, but I missed that there were already two Java 8 answers when I wrote this. Probably because one was labeled "Java (OpenJDK 8)" and the other was just "Java 8". Whatever the reason, this answer was invalid. I re-wrote it in a different language, with the same byte count, to fix this.

275. Whispers, 113 bytes, A001021

> Input
> 12
>> 2*1
>> Output 3
Rather than add a bunch of spaces,
I think it'd be better to actually have
words.

Try it online!

Next sequence

How it works

The parser automatically removes lines that don't match any of the valid regexes, meaning that the code that actually gets executes is

> Input
> 12
>> 2*1
>> Output 3

Which is executed non-linearly way (as most Whispers programs are), and runs as follows:

Output ((12) * (Input))

Where * is exponentiation (raising x to the power y)

277. 2sable, 104 bytes, A000188

Ln¹%1‹Oquery: no rules about unnecessary text?
Nearest available byte count is 104 so this code is on it

Try it online!

Next Sequence

It didn't seem like there was a rule against unnecessary text but if I misinterpreted I will delete.

Explanation

Ln¹%1‹Oq     Only part of the code that gets evaluated
L            [1...n] where n is the input
 n           square: [1,4,9,...n**2]
  ¹          push the input n
   %         mod: [1%n,4%n,...(n**2)%n]
    1        push 1
     ‹       less than 1: [1%n<1,4%n<1,...(n**2)%n<1]
      O      count the ones in the array
       q     terminate the program
uery: no...  not evaluated

Regarding the next sequence, I almost skipped it because it looks hard but then changed my mind. It seems like a high level language would be useful there. I've noticed there are no Maple answers so someone could try it in that. There is also Pyon which from this answer seems like it is essentially just Python so I don't know if we are counting it as a separate language. Fortran is also available for an answer but I don't know if many people use it and it is not so high level.

266. UCBLogo, 2572 bytes, A000636

; ------ helper function ------ (unrelated to the problem)

; minimum of two numbers
to min :x :y
    output ifelse :x<:y [:x] [:y]
end

; clone an array
to clone :arr
    localmake "ans (array (count :arr) (first :arr))
    localmake "offset -1+first :arr
    repeat count :arr [
        setitem (#+:offset) :ans (item (#+:offset) :arr)
    ]
    output :ans
end

; ------ coefficient list manipulators ------

; apply (map binary function)
to ap :func :x :y
    localmake "ans arz min count :x count :y
    for [i 0 [-1+count :ans]] [ 
        setitem :i :ans (invoke :func item :i :x item :i :y)
    ]
    output :ans
end

; zero-indexing zero array : f(x) = 0
to arz :n 
    localmake "ans (array :n 0)
    repeat :n [setitem #-1 :ans 0]
    output :ans
end

; polynomial multiplication
to convolve :x :y [:newsize (count :x)+(count :y)-1]
    localmake "ans arz :newsize
    for [i 0 [-1+count :x]] [
        for [j 0 [min -1+count :y :newsize-:i-1] 1] [
            setitem :i+:j :ans (item :i+:j :ans) + (item :i :x) * (item :j :y)
        ]
    ]
    output :ans
end

; given arr = coefficients of f(x), calculate factor * f(x^n)
to extend :arr :n [:factor 1]
    localmake "ans arz (-1+count :arr)*:n+1
    repeat count :arr [
        setitem (#-1)*:n :ans (:factor*item #-1 :arr)
    ]
    output :ans
end

; calculate :const + :factor * x * p(x)
to shift :p :factor :const [:size 1+count :p]
    localmake "ans (array :size 0)
    setitem 0 :ans :const    ; 1+...
    repeat :size-1 [
        setitem # :ans (item #-1 :p)*:factor
    ]
    output :ans

end

; calculate multiplication inverse (1/p(x))
to inverse :p [:n (count :p)]
    localmake "one arz :n
    setitem 0 :one 1

    localmake "p_1 clone :p
    setitem 0 :p_1 (-1+item 0 :p_1) ; p_1(x) = p(x) - 1

    localmake "q (array 1 0)
    setitem 0 :q (1/item 0 :p) ; q(x) = 1/p(0) (coefficient of x^0)

    repeat :n [
        make "q ap "difference :one (convolve :p_1 :q #)
    ]

    output :q
end

; ------ define functions ------

; calculate r(x) first n coefficients
to r :n
    localmake "ans {1}@0
    repeat :n [
        make "ans (shift (ap "sum ap "sum
            convolve convolve :ans :ans :ans ; r[x]^3
            convolve :ans (extend :ans 2 3)  ; 3*r[x]*r[x^2]
            (extend :ans 3 2)  ; 2 r[x^3]
        ) 1/6 1 #)
    ]
    output :ans
end

; calculate R(x) first n coefficients
to BigR :n
    localmake "rn r :n
    output (extend
        ap "sum
            convolve :rn :rn ; r[x]^2
            extend :rn 2     ; r[x^2]
    1 0.5)  ; /2
end

; main function
to main :n
    localmake "Rx bigR :n+1
    localmake "inv_1_xRx inverse shift :Rx -1 1 ; 1 - x*R[x]
    output item :n+1 (extend (ap "sum
        :inv_1_xRx
        convolve
            (shift :Rx 1 1)   ; 1 + x*R[x]
            (extend :inv_1_xRx 2) ; 1/(1 - x^2 * R[x^2])
    ) 1 0.5)
end

Try it online! (at Anarchy golf performance checker)

Paste the code there, and then append print main 10 at the end.

Although Logo has been used twice, UCBLogo only once and FMSLogo only once. In other word, programming languages that has multiple versions tend to have more advantage in this challenge. Next time it will probably be Elica.


Next sequence.

276. MATLAB, 188 bytes, A000113

n=input('')+1;
F=factor(n);
psi = @(x) x*prod(1+1./unique(F))-(x<2);
i=sum(F==2);
j=sum(F==3);
if i > 5
i = 3;
else
i = floor(i./2);
end
if j > 1
j = 1;
else
j = 0;
end
psi(n) ./ (2^i*3^j)

Try it online!

Next Sequence

As this is a carefully written polyglot with Octave, it will run on TIO.

Implements the formula with Dedekind's psi function listed in the notes.

Oddly, there's a dead link for transformation groups on this OEIS wiki page and I'm not entirely sure how to count transformation groups!

272. SNOBOL4 (CSNOBOL4), 129 bytes, A010008

	INPUT('READLINE', 5)
	IN = READLINE
	OUTPUT('PRINT', 6)
	EQ(IN,0)			:S(OK)	
	OUTPUT = 18 * IN * IN + 2	:(END)
OK
	OUTPUT = 1
END

Try it online!

Next sequence

I think I could probably write another answer in SNOBOL; it took me a good ten minutes to figure out how to do I/O because I'm dumb, and I'm lucky the sequence was so stupidly easy.

Explanation:

SNOBOL is pretty old, so it has some weird quirks for someone who's been using more "modern" languages. First of all, you have to indent lines, because un-indented lines are labels. Control flow is purely through GOTOs, labels, and SUCCESS/FAILURE of a line. And I'm still not sure about how to write a comment.

INPUT('READLINE', 5) sets a variable READLINE that takes input from file 5, which is by default the keyboard/console input.

IN = READLINE reads a single line from the file as a string.

OUTPUT('PRINT', 6) sets a variable PRINT that prints to file 6, which is by default the console.

EQ(IN,0) tests for equality between the input and 0. The GOTO:S(OK) is the instruction "on Success, goto OK", so it jumps to OK, setting OUTPUT to 1, printing, and then hitting END.

Otherwise, it sets the output to 18*n^2+2 and jumps to the END, terminating the program.

274. ArnoldC, 1021 bytes, A000123

IT'S SHOWTIME
HEY CHRISTMAS TREE INPUT
YOU SET US UP @I LIED
HEY CHRISTMAS TREE OUTPUT
YOU SET US UP @I LIED
GET YOUR ASS TO MARS INPUT
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY
GET YOUR ASS TO MARS OUTPUT
DO IT NOW A000123 INPUT
TALK TO THE HAND OUTPUT
YOU HAVE BEEN TERMINATED

LISTEN TO ME VERY CAREFULLY A000123
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE INDEX
GIVE THESE PEOPLE AIR
HEY CHRISTMAS TREE NUMBER1
YOU SET US UP @NO PROBLEMO
HEY CHRISTMAS TREE NUMBER2
YOU SET US UP @NO PROBLEMO
BECAUSE I'M GOING TO SAY PLEASE INDEX
GET TO THE CHOPPER NUMBER1
HERE IS MY INVITATION INDEX
GET DOWN 1
ENOUGH TALK
GET TO THE CHOPPER NUMBER2
HERE IS MY INVITATION INDEX
HE HAD TO SPLIT 2
ENOUGH TALK
GET YOUR ASS TO MARS NUMBER1
DO IT NOW A000123 NUMBER1
GET YOUR ASS TO MARS NUMBER2
DO IT NOW A000123 NUMBER2
GET TO THE CHOPPER NUMBER1
HERE IS MY INVITATION NUMBER1
GET UP NUMBER2
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC
I'LL BE BACK NUMBER1
HASTA LA VISTA, BABY

Try it online!

Next Sequence

Uses the recurrence relation a(n) = a(n-1) + a(floor(n/2))

273. Ohm v2, 123 bytes, A000129

2¬1+³ⁿ1 2¬-³ⁿ-2¬d/¦                                                                                                        

Try it online! (note the trailing spaces)

Next Sequence.

I didn't want to nearly-kill the challenge again, so I chose A000123, which isn't that hard.

Implements a(n) = ((1+√2)n - (1-√2)n) / (2√2), rounded to the nearest integer (because there are small floating-point inaccuracies).

233. Hexagony, 141 bytes, A000332

    ? } = & \
   . . @ } ( .
  ( . . . _ . .
 . } . . 2 & . .
. . * . 4 . { . .
 . . ' \ ' \ * . 
  . . ( . : . "
   . . { ! . .
    . . * . .

Try it online!

Next sequence!

Note: due to problems with remembering to check whether a bytecount was used before (to be clear: in this case, not by me), this answer has changed 2 times in total, with each of the 3 programs having a full explanation. Check the revision history if you want.

Explanation

There's practically no control flow here. The code has one, constant execution path. It starts at the top left corner going right, gets reflected by multiple mirrors, wraps around a few times and passes through unrelated instructions after printing the result to end at the @ (I'm sorry) in the second row. For reference, here's a picture of the execution path, with a color change every time it hits a mirror. I also changed the color during a long stretch of instructions on the bottom left to make the wraparound clear.

control flow diagram

The code operates on 3 memory edges: let's call the one we start on A, the one to the left of it - L, and the one to the right of A - R. binomial(n, 4) can be evaluated with the formula n(n-1)(n-2)(n-3)/24, which is imminent if you think about it, and a similar one could be created for every constant value of the bottom argument. Let's consider the linear path the code takes:

?}=&(}=*{('*}("*{&24':!*=@
?                          Input integer. A = n
 }=&                       Move to the R edge and copy the value of n. R = n
    (                      Decrement. R = n - 1
     }=                    Move to the L edge.
       *                   L = A * R = n(n-1)
        {(                 Move to the R edge and decrement. R = n - 2
          '                Equivalent to ={=, move to the A edge.
           *               A = L * R = n(n-1)(n-2)
            }(             Move to the R edge and decrement. R = n - 3
              "            Equivalent to =}=, move to the L edge.
               *           L = A * R = n(n-1)(n-2)(n-3)
                {&         Move to the R edge and set it to 0 using an edge that
                           hasn't been used before
                  24       Set the value of the R edge to 24. A digit in Hexagony
                           multiplies the edge value by 10 and adds its value to
                           it, which allows chaining them to create multi-digit
                           numbers, but requires the value of the edge to be 0
                    '      Equivalent to ={=, move to the A edge
                     :     A = L / R = n(n-1)(n-2)(n-3)/24 = a(n)
                      !    Print the result
                       *=  Instructions that happen to be in the execution path
                           and not disrupt it
                         @ End the program

260. Brain-Flak, 504 bytes, A001333

<>       # switch to another stack
(())(()) # push two 1s. Assuming top = a n-1, second top = a n-2 apart from the input
<>({}<>) # transfer the input to this stack
{        # repeat input times
    ({}[()]<     # subtract 1, ignore 
      (
        ({}<>)   # move top a n-1 to another stack
        ({})     # + top a n-1
        <>{}<>   # add to a n-2 on the other stack
      )          # and push 2 * a n-1 + a n-2
    >)           # and push back again
}
{}{}     # remove redundant values on top 

Try it online!

Next sequence.

The actual code is only 52 bytes: Try it online!

Use the recurrence relation

a(n) = 2a(n-1) + a(n-2)

described on the OEIS page.


The mathematical information about that sequence is pretty simple and elementary, and not worth the effort I write the explanation, so I decide to not write explanation for this sequence.

201. Nim, 213 bytes, A000189

from strutils import parseint
import math

proc A000189(index: int): int =
  result=1
  for x in 1..index-1:
    if x^3 mod index == 0:
      result = result + 1
  return

echo A000189(parseint(readline(stdin))+1)

Try it online!

Next Sequence.

200. shortC, 189 bytes, A000092

Note: byte count includes the +3 bytes for -lm.

f(x){Lr=0,d=0,n=1;O;d<x+1;n++){Lc=0,m=ceil(sqrt(n))+1,i=-m,j,k;O;i<m;i++)Oj=-m;j<m;j++)Ok=-m;k<m;k++)c+=i*i+j*j+k*k<=n;c-=lround(sqrt(n*n*n)*4.18879020478639);c=abs(c);Fc>r)d++,r=c;}Tn-1

Try it online!

Next sequence!

Yay, 200th answer.

144. Chez Scheme, 68 bytes, A000120

(define(e n)(cond((< n 1)0)((+(e(fx/ n 2))(remainder n 2)))))       

Try it online!

Next sequence

143. Excel, 120 bytes, A000782

=2*FACT(2*A1)/(FACT(A1)*(FACT(A1+1)))-IFERROR(FACT(2*A1-2)/(FACT(A1-1)*(FACT(A1))),0)                                   

Next sequence!

Input is in cell A1. It just implements the function listed on OEIS:

a(n) = 2 * C(n) - C(n-1)
C(n) = (2n)! / (n!(n+1)!)

Technically, only n > 0 should be valid so the IFERROR bit could be dropped since it only errors on n < 1. I left it in for artistic license and to have what I think is a more interesting next sequence.

135. Husk, 29 bytes, A000277

*1*1*1*1*1*1*1+5-*2⌊√+5*4⁰*3⁰

Try it online!

Next Sequence.

134. Emoji, 277 bytes, A000643

📥💬i💬📲
💬0💬📥👥
⛽
💬i💬📱👥💬1💬📥🌊💬i💬📲💬1💬📥🐔
🚘⛽
💬1💬📥⛽
🔀👥💬1💬📥🌊🔀💬0💬📥🐔
🚘⛽
🔀💬2💬📥👪
🚘🔃🔚🐧🔀👥💬t💬📲👫💬t💬📱
🚘🔃🔀➡

Try it online!

Next sequence!

Explanation:

In contrast to Emojicode, Emoji is an esoteric programming language. Emoji is similar to GolfScript and CJam in that it uses a stack as the primary memory.

		Implicitly push all arguments as string. Stack: "7"
📥		Floor. Normally 🔢 would be used to get a float, but using
		floor gives an int, which (since the interpreter is written
		in Python) is a bignum. Stack: 7
💬i💬📲		Store to variable i. Stack:
💬0💬📥👥		Push "0", to string, duplicate. Stack: a(1) a(0)
⛽...🚘⛽...🚘🔃	While(...) do ... (let's look later in the loop)
💬i💬📱		(in while condition) recall variable i. Stack: a(4) a(3) i
👥		Duplicate. Stack: a(4) a(3) i i
💬1💬📥🌊		Subtract 1. Stack: a(4) a(3) i i-1
💬i💬📲		Store i-1 to i for next iteration. Stack: a(4) a(3) i
💬1💬📥🐔		Is greater than 1? This means that the outer loop will be
		repeated n - 1 times, where n is the input.
		Stack: a(4) a(3) true
💬1💬📥		(in outer loop) Now we will calculate 2^a(3) - push 1.
		Stack: a(4) a(3) 1
⛽...🚘⛽...🚘🔃	While(...) do ... (now a(3) is the loop counter, let's assume
		we are at the last iteration of this loop.)
🔀		Swap. Stack: a(4) 2^(a(3)-1) 1
👥		Duplicate. Stack: a(4) 2^(a(3)-1) 1 1
💬1💬📥🌊		Subtract 1. Stack: a(4) 2^(a(3)-1) 1 0
🔀		Swap. Stack: a(4) 2^(a(3)-1) 0 1
💬0💬📥🐔		Is greater than 0? This means that the inner loop will be
		repeated a(3) times. Stack: a(4) 2^(a(3)-1) 0 true. Notice
		that after true is popped, the two values are swapped compared
		to the beginning of the condition evaluation. This has to be
		fixed both in the inner loop and after it.
🔀		(in inner loop) swap. Stack: a(4) 0 2^(a(3)-1)
💬2💬📥👪		Multiply by 2. Stack: a(4) 0 2^a(3).
		The loop ends. Stack: a(4) 2^a(3) 0
🔚🐧		The counter is now always 0 and has to be discarded. Since
		there is no such instruction, an empty if is used instead.
		Stack: a(4) 2^a(3)
🔀		Swap. Stack: 2^a(3) a(4)
👥💬t💬📲		Duplicate and store a(4) in t. Stack: 2^a(3) a(4)
👫		Add. Stack: a(5)
💬t💬📱		Restore a(4) from variable. Stack: a(5) a(4).
		The loop ends here. Stack: a(7) a(6).
🔀		Swap. Stack: a(6) a(7).
➡		Print a(7). The stack is discarded at the end of the program.

Emoji aren't fixed-width in a fixed-width font, so spaces don't work for alignment. Fortunately, tabs work, but different emoji fonts might slightly break it.

270. Husk, 103 bytes, A000118

←→-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1+*1=⁰0*±⁰≠*8Σu†ΠṖp⁰*<1%4⁰*32Σu†ΠṖp/4⁰

Try it online!

Next Sequence.

Ignore the madness that precedes the actual code, it’s just fluff to make this 103 bytes.

How it works

Husk does not have a “divisors” built-in, so ( has been implemented) this was actually fun to solve.

To put it simply, it calculates (N==0 ? 1 : 0)+sgn(N)(8σ(N)+32σ(N/4)(N%4==0 ? 1:0)).

269. Pip, 118 bytes, A000099

n:0
m:0
++a
W a {
  ++n
  Y -n\,n
  AA:{$+a*a<=n} MS yCPy
  VV:PI*n
  PP:AA-VV
  I ABPP>m {
    m:ABPP
    --a
  }
}
n

Try it online! (times out for indices greater than 7)

Next sequence

Commented

Implements the definition of the sequence:

n:0            Index of helper sequences
m:0            Max value of |P(n)| so far
++a            Index of main sequence (++ because the definition is 1-indexed)
W a {          Count down until a hits 0:
  ++n           Increment index of helper sequence
  Y -n\,n       Yank inclusive range [-n, n]
  AA:           Sequence A(n) is:
    {$+a*a<=n}   Function: Square items of list, sum, and check <= n
    MS           Map-sum
    yCPy         Cartesian product of y with itself
  VV:PI*n       Sequence V(n) is pi times n
  PP:AA-VV      Sequence P(n) is A(n)-V(n)
  I ABPP>m {    If abs(P(n)) > current max value:
    m:ABPP       Max is abs(P(n))
    --a          Decrement index of main sequence
  }
}
n              Output index of helper sequence at the a'th maximum

268. Pyke, 99 bytes, A000338

9 2/Q2+X*15 2/Q2+*-BQ1>*Q0q5*Q1q18*++                                                              

Try it here!

Next sequence. (quite tendious, yet doable I think)

267. Erlang (escript), 338 bytes, A002572


h(N,A,_) when A > N -> 0;
h(N,A,_) when A == N -> 1;
h(N,A,B) -> case erlang:get({N,A,B}) of
	F when is_integer(F) -> F;
	'undefined' -> 
		F = lists:sum(lists:map(
			fun(I) -> h(N-I, (A-I)*2, B+1) end,
		lists:seq(0, A-1))),
		erlang:put({N,A,B}, F),
		F
	end.

main([])-> {ok, [N]} = io:fread("", "~d"),
io:fwrite("~p", [h(N+1,1,0)]).

Try it online!

Next sequence!

I first wrote this in Python, and then I had decided to find a language with bignums, because this sequence grows pretty quickly. I hope this will explain it pretty well:

cache = {}
# Calculate the number of partitions of a/(2^b) into n powers of (1/2), with
# the exponent of at least b. You need at least a powers of (1/2) for the
# trivial solution of a*(1/2)^b, and you cannot write any of the fractions
# in that solution as a sum of smaller fractions if a = n.
def B(n, a, b):
    if a > n:
        return 0

    if a == n:
        return 1
    
    if (n, a, b) not in cache:
# We need more fractions - use 1/(2^b) from 0 to (a-1) times, and fill
# the rest with the recursive call of this function

        s = 0
        for i in range(a):
            s += B(n - i, # we used i fractions
                   (a - i) * 2, # use a higher power of (1/2)
                   b + 1)
        cache[(n, a, b)] = s

    return cache[(n, a, b)]

def A(n):
    return B(n, 1, 0)

for n in range(1, 2000):
    print(n, A(n))

Memoization in Erlang from this SO answer

264. PowerShell, 102 bytes, A000493

function A000493($n) {return [math]::floor([math]::sin($n))}

# Please, let's get this to 102. Please?

Try it online!

Next sequence.

12. Java (OpenJDK 8), 131 bytes, A000064

int f(int n){int[]a=new int[n+1],c={1,2,5,10,1};a[0]=1;for(int i=0,j,k;i<5;i++)for(j=c[i],k=0;j<=n;j++,k++)a[j]+=a[k];return a[n];}

Try it online!

Next sequence

215. MATL, 95 bytes, A000383

'this is just a random string for padding aagghhhh need at least 80 chars!'xT6Y"i:"t-5:0)sh]GQ)

Try it online!

Next sequence

'...'x                 string and delete from stack
T6Y"                   push 6 ones
i:"                    iterate user input number of times
   t-5:0)sh            dup, index last 6, sum, horzcat
           ]           end loop
            GQ)        copy user input, increment, index (return)

263. Visual Basic .NET (.NET Core), 493 bytes, A000091

It is a multiplicative function. Using a simple prime checking function.

Now VB .NET was used twice.

Function IsPrime(p As Integer) As Boolean
 For i = 2 To p - 1
  If p Mod i = 0 Then Return False
 Next
 Return True
End Function

Function A000091(n As Integer) As Integer
 n += 1
 If n = 1 Then Return 1
 If n Mod 9 = 0 Then Return 0

 Dim ans As Integer = 1
 If n Mod 2 = 0 Then ans *= 2
 If n Mod 3 = 0 Then ans *= 2
 While n Mod 2 = 0
  n /= 2
 End While
 For i = 5 To n
 If IsPrime(i) And n Mod i = 0 Then
  If i Mod 3 = 1 Then ans *= 2 Else Return 0
 End If
 Next
 Return ans
End Function

Try it online!

Next sequence

I chose a simple sequence. The smallest unused sequence until now is A000099.

261. Alice, 115 bytes, A000504

/
 i                            >'Qa*:\ o
  /.!.h*?2Ea*?a5+*+2+*?2*3+.!w=
                              >?*?2-.!K @

Try it online!

Next sequence.

Uses the formula used by the Mathematica snippet on OEIS:

a[n_] := n (n+1) (10n^2+15n+2) (2n+3)!! / 810

In detail:

/      Switch to Ordinal mode.
i      Read all input as a string.
/      Switch back to Cardinal mode.
.!     Implicitly convert the input to an integer N and store a copy on the tape.
.h*    Multiply N by (N+1).
?2E    Retrieve a copy of N and square it.
a*     Multiply by 10.
?a5+*  Retrieve another copy of multiply it by 15.
+      Add the last two results.
2+     Add 2.
*      Multiply the initial value by this, giving N*(N+1)*(10N^2+15N+2)
?2*3+  Retrieve another copy of N and compute 2N+3, which will be our
       iterator for the double factorial.
.!     Store a copy of this on the tape.
w      Push the current IP address to the return address stack. This starts
       a loop.
  =      Sign junction. Pops the current value of the double factorial iterator.
         If it's positive, turn right (continuing the loop). If it's negative,
         turn left (exiting the loop).
  >      Redirect the IP eastward again.
  ?*     Multiply our result by the current value of the iterator.
  ?2-    Retrieve another copy of the iterator and subtract 2.
  .!     Store a copy on the tape to update the iterator.
K      Jump back to the w to get to the next iteration.

       Once we exit the loop, we continue here:
>      Redirect the IP eastward again.
'Qa*:  Divide the result by 810 (computed as 81*10).
\      Switch to Ordinal mode.
o      Implicitly convert the result to a string and print it.
@      Terminate the program.

262. Cubically, 91 bytes, A000115

$:7*1+4/1**1+55/1RFD'/2%:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Try it online!

Next sequence.

Use the formula

a(n) = round((n+4)^2/20).

listed on the OEIS page.

Originally I intended to format the code as a cube, something like

  $:7*1
 +    4
/1**1 +
5   5 /
1   RF
D'/2%

but it does not work out too well, because Cubically does not have comments and it is not allowed to put spaces between command and parameters, unfortunately.

More explanation later.

259. Hy, 1333 bytes, A000329

(setv precision 80)

(import decimal)

(setv ctx (.getcontext decimal))
(setv ctx.prec precision)
(setv Decimal decimal.Decimal)

(defn approx-pi [series-terms]
  (sum
    (list-comp
      (/ (- (/ 4 (Decimal (+ 1 (* 8 n))))
            (/ 2 (Decimal (+ 4 (* 8 n))))
            (/ 1 (Decimal (+ 5 (* 8 n))))
            (/ 1 (Decimal (+ 6 (* 8 n)))))
         (** 16 n))
      (n (range series-terms)))))

(setv pi (approx-pi precision))

(defn cos [x series-terms]
  (cond
    [(>= x (* 2 pi))
     (cos (- x (* 2 pi)) series-terms)]
    [(neg? x)
     (cos (- x) series-terms)]
    [(>= x (/ (* 3 pi) 2))
     (cos (- (* 2 pi) x) series-terms)]
    [(>= x pi)
     (- (cos (- x pi) series-terms))]
    [(>= x (/ pi 2))
     (- (cos (- pi x) series-terms))]
    [True
     (sum
       (list-comp
         (*
           (if (even? n) 1 -1)
           (reduce *
             (list-comp
               (/ x (inc i))
               (i (range (* 2 n))))
             1))
         (n (range series-terms))))]))

(defn tan [x series-terms]
  (/
    (cos (- x (/ pi 2)) series-terms)
    (cos x series-terms)))

(setv bvalues {0 (Decimal 1)})

(defn b [n]
  (try
    (get bvalues n)
    (except [KeyError]
      (do
        (assoc bvalues n (tan (b (dec n)) precision))
        (get bvalues n)))))

(defn A000329 [n]
  (int (round (b n))))

Next sequence

The difficulty with this sequence is that it's an iterated function, which means that small floating-point errors are magnified as n increases. So we need very accurate numbers. Enter Python's decimal module, which supports arbitrary-precision decimal arithmetic!

Because the decimal module doesn't seem to have trig functions, I reimplemented pi and cos. To calculate pi, I used the series approximation here, which converged pretty fast. For cosine, I used the MacLaurin series. Then I implemented tan as sine over cosine, with sin(x) = cos(x - pi/2).

Finally, I used the definition of A000329 from OEIS: "Nearest integer to b(n), where b(n) = tan(b(n-1)), b(0) = 1." I memoized the definition of b--not really necessary, but speeds up the generation of tables of values. Some experimentation showed that a decimal precision of 80 was sufficient to correctly compute n = 1000.

Now, of course, Python itself has already been used in this challenge, so the next task was to find a Python-based language that hadn't been used yet. I found Hy, which is basically Python with Lisp syntax. One translation, new Ubuntu VM, and language installation later, and voilà!

253. MIT/GNU Scheme, 1516 bytes, A000251

(define (add f g)
  (stream-map + f g) )

(define (sub f g)
  (stream-map - f g) )

(define (scale c f)
  (stream-map (lambda (v) (* c v)) f) )

(define (adddiag sf)
  (let ((f0 (stream-first sf)))
    (cons-stream (stream-first f0)
                 (add (stream-rest f0) (adddiag (stream-rest sf))) ) ) )

(define (mult f g)
  (adddiag (stream-map (lambda (v) (scale v g)) f)) )

(define (prependzeros n f)
  (if (= 0 n) f (cons-stream 0 (prependzeros (-1+ n) f))) )

(define (intersperse f n)
  (cons-stream (stream-first f)
               (prependzeros n (intersperse (stream-rest f) n)) ) )

(define (iterate fun init)
  (cons-stream init (iterate fun (fun init))) )

(define (from n)
  (iterate 1+ n) )

(define (scanl fun init s)
  (cons-stream init (scanl fun (fun init (stream-first s)) (stream-rest s))) )

(define (expx f)
  (cons-stream 1
               (adddiag (stream-map (lambda (s g) (scale (/ 1 s) g))
                                    (scanl * 1 (from 2))
                                    (iterate (lambda (g) (mult f g)) f) )) ) )

(define (eu f)
  (expx (adddiag (stream-map (lambda (n) (scale (/ 1 n)
                                                (intersperse f (-1+ n)) ))
                             (from 1) ))) )


(define ones
  (cons-stream 1 ones) )

(define s
  (iterate eu ones) )

(define r
  (stream-map sub (stream-rest s) s) )

(define t6
  (sub (stream-ref r 1)
       (cons-stream 0 (mult (stream-first r) (stream-ref s 1))) ) )

(define (f n)
  (stream-ref t6 (+ 6 n)) )

Next sequence

Use like this:

$ scheme -load t6.scm
MIT/GNU Scheme running under GNU/Linux
[...]
1 ]=> (f 49)

;Value: 1110994054004

This answer is based on generating functions given in J. Riordan's paper The Enumeration of Trees by Hight and Diameter mentioned at the OEIS entry of the sequence. Equation numbers will refer to this paper.

First, let s_h(x) be the counting generation function of rooted trees with height at most h by number of nodes, i.e. the coefficient of x^n will give the number of such trees with n nodes. All our generating functions will count by number of nodes in this way.

We can get one such function from the previous by eq. (1):

s_{h+1}(x)=x*exp(s_h(x)+s_h(x^2)/2+s_h(x^3)/3+...)

This is a shifted Euler transformation, which makes sense: the transformation takes a series a_0=0, a_1, a_2... where the a_i tell in how many ways you can get a thing of size/weight/whatever i and gives a series b_0=1, b_1, b_2... where b_j tells in how many ways you can get a multiset of such things with total size/weight/... of j. A rooted tree of height at most h+1 corresponds to a bunch (multiset) of rooted trees of hight at most h, with all their roots connected to a new root, which explains the shifting (multiplication with x).

My function eu (I'm reusing a big part of my solution No. 122) to compute the Euler transformation takes a sequence starting with a_1 and returns a sequence starting with b_0. If we keep our sequences starting with the coefficient of x, we just need to iterate the eu function and the shifting is automatic. The code defines s as infinite stream of s_h (the highest we need is s_3, but it is still simpler like this), where we could start with s_0(x)=x, or even s_{-1}(x)=0, but we start with s_1(x)=x/(1-x)=x+x^2+x^3+.... BTW, s_2 is almost the generating function for the partition numbers, just shifted.

Next, let r_h(x) be the generating function for rooted trees with height exactly h. Obviously, we have r_h(x)=s_h(x)-s_{h-1}(x). The code defines r to be the stream of these r_h, starting with r_2.

Finally, let t_d(x) be the generating function for trees of diameter d. For even d, thos can be expressed by eq. (6a) as

t_{2d}(x) = r_d(x) - r_{d-1}(x)*s_{d_1}(x)

The paper derives this formula algebraically from some other, but it can also be seen directly by comparing coefficients. For fixed d and n it claims that there are as many rooted trees of height d and with n nodes, as there are elements in the disjoint union of (1) trees of diameter 2d and with n nodes, and (2) pairs of rooted trees of height d-1 and of rooted trees of height at most d-1, where the pair has a total number of n nodes. This can be shown by a bijection: given a rooted tree of height d, remove the root and look at the multiset of subtrees you get. At least one of them has height d-1. If there are more than that, then the original tree was of diameter 2d. So forget the root and map it to this tree. Otherwise, form a pair with the one subtree of size d-1, and a tree of size at most d-1 that is created by rejoining the other subtrees with a new root. (Details are left as an exercise to the reader...)

The code directly defines t_6 according to this formula. Since we kept the generating functions starting with x while the multiplication function expects series starting with the constant term, the result must be interpreted as starting with the coefficient of x^2. To compensate, we put a 0 in front of it.

And if you ever need to enumerate trees with odd diameter, their generating function is given by eq. (5) as

t_{2d+1}(x) = (r_d^2(x)+r_d(x^2))/2

229. FMSLogo, 1147 bytes, A000361

Number of byte: 1132 (code) + 15 (flags) = 1147. Avoid confusing the code snippet.

Need parameter -h 8200 -w 8200 to enlarge the canvas size.

to size ; Constant. Must be power of 2
    op 4096
end

to draw :halfedge :maincol :altcol
    if :halfedge < 4 [stop] ; all fractals need base case
    draw :halfedge / 2 :maincol :altcol
    fd :halfedge rt 60
    fd :halfedge rt 60
    draw :halfedge / 2 :altcol :maincol
    rt 60
    drawtria :halfedge :maincol
    rt 60
    draw :halfedge / 2 :altcol :maincol
    fd :halfedge rt 120 bk :halfedge
end

to drawtria :edge :col
    if :edge <> 4 [stop]
    setpc :col
    pd
    repeat 3 [fd :edge rt 120]
    pu
    rt 30 fd :edge/2
    setfc :col
    fill
    bk :edge/2 lt 30
end

to main :index
    make "index :index + 1 ; Must be 0-based
    pu home ht
    bk size rt 90 bk size lt 60
    if not namep "drawn [
        draw size "purple "gray
        make "drawn "
    ]
    fd 8 * :index
    rt 150
    fd 4 * (sqrt 3) / 2 * (4 / 3) ; Go to the centroid of the next triangle
    localmake "result 0
    while [ycor > -size - 10] [
        if pixel = [128 0 128] [make "result :result * 2 + 1] ; purple
        if pixel = [128 128 128] [make "result :result * 2] ; gray
        fd 8 * (sqrt 3) / 2
    ]
    op :result
end

Testing:

print main 10

Unfortunately, no implementation of the Logo programming language I can find include the function pixel (used to retrieve pixels on the screen), and FMSLogo appear to be limited to Windows. However JSLogo can draw the fractal.

However, this code is likely to take forever to run on FMSLogo. For testing purposes:

Explanation:

  1. What is that sequence: See this image for details. Basically the sequence is binary representation of the columns of congruent triangles. Also the pattern is defined like this (drawn lines indicates symmetry axes of the triangles).
  2. Why is Logo useful here: Because Logo has built-in turtle graphics. So draw the fractal at smaller size and rotated is not problem for Logo. After drawing, you just need to read the pixels.

Next Sequence

257. TI-NSpire CX Basic, 144 bytes, A000562

Define a562(n)=
Func
:If n=4 Then
:  Return 9
:Else
:  Return ((27)/(8))*n^(4)-((135)/(4))*n^(3)+((921)/(8))*n^(2)-((539)/(4))*n
:EndIf
:EndFunc

Next sequence

Uses Plouffe's conjecture mentioned in the OEIS entry, note that this is different than TI-Nspire CAS Basic as they are two different models of calculator. Next sequence hopefully is easy.

This allows the language to be used again before the 300th.

255. Perl 5, 454 bytes, A000098

sub part {
 my $S;
 if ($_[1]==0) { $S = 1 } elsif ($_[1] < $_[0]) { $S = 0 } else { $S = part($_[0],$_[1]-$_[0])+part($_[0]+1,$_[1]) }
 $S;
}

sub partsum {
 my @a = (0..$_[0]);
 my $S = 0;
 for my $i (@a) {
  $S += part(1,$i);
 }
 $S;
}

sub A000097 {
 my @a = (0..$_[0]//2);
 my $S = 0;
 for my $i (@a) {
  $S += partsum($_[0]-2*$i);
 }
 $S;
}

sub A000098 {
 my @a = (0..$_[0]//3);
 my $S = 0;
 for my $i (@a) {
  $S += A000097($_[0]-3*$i);
 }
 $S;
}

Next Sequence

Try it online!

There's a lot of redundant subroutine calls, so memoization would speed this up a lot.

254. Enlist, 98 bytes, A001516

W F †  0r   ‡ ;@ ±@ ¹ ! :/ §€¹  Ė  ‡ 2* :2 :@ §/€   † ↕ ḥ1 ↕ ×J ḥ1 § † ↕ ḥ1 ↕ ×J ḥ1 §   ;0   S  §€

Try it online!

haha enlist can do a thing :D

Next Sequence

Explanation

WF†0r‡;@±@¹!:/§€¹Ė‡2*:2:@§/€†↕ḥ1↕×Jḥ1§†↕ḥ1↕×Jḥ1§;0S§€  Main Link
W                                                      wrap; x => [x]
 F                                                     flatten (WF is just for test suite purposes lol)
                                                    €  For each (this just returns the first `n` elements if the input is an integer)
  †                                                §   Execute a monadic bracketed chain on each (let's call the argument `z`)
   0r                                                  Range from 0 to `z`, inclusive
               €                                       For each in the range
     ‡        §                                        Execute a dyadic bracketed chain on each (let's call the argument `n`)
      ;@                                               Append `n` to
        ±@¹                                            [z + n, z - n]
           !                                           Factorial (of each)
            :/                                         Reduce over division (this gives (z + n)! / (z - n)! / n! which is what we want as the coefficient)
                ¹                                      Identity as right argument to prevent dyad-monad chaining
                 Ė                                     Enumerate 1-indexed
                           €                           For each enumerated element (let's call the argument [x, y])
                  ‡      §/€                           Reduce over dyadic function (gives `x $ y`)
                   2*                                  2 ^ x
                     :2                                / 2 (floored)
                       :@                              y / (floored)
                                                     (this is y / 2 ^ (x - 1))
                            †        §                 Monadic bracketed expression (derivative step)
                             ↕                         Reverse
                              ḥ1                       All but last 1 element
                                ↕                      Reverse
                                 ×J                    Multiply each with its index
                                   ḥ1                  All but last 1 element
                                      †↕ḥ1↕×Jḥ1§       Derivative again
                                                ;0     Append 0 (to prevent empty-sum errors)
                                                  S    Sum

250. Coconut, 711 bytes, A000171

from collections import Counter
from math import gcd, factorial

def sparts(n, m=4):
  if n%2==1:
    return [ [1] + p for p in sparts(n-1) ]
  elif n==0:
    return [ [] ]
  elif n<m:
    return []
  else:
    return [ [m] + p for p in sparts(n-m,m) ] + sparts(n,m+4)

def ccSize(l) =
  centSize = [ val**mult * factorial(mult)
               for val, mult in Counter(l).items() ] |> reduce$(*)
  factorial(sum(l)) // centSize

def edgeorbits(l) =
  samecyc = sum(l) // 2
  diffcyc = sum ([ gcd(l[i],l[j])
                   for i in range(len(l)) for j in range(i) ])
  samecyc + diffcyc

def a(n) =
  sum ([ ccSize(l)*2**edgeorbits(l)
         for l in sparts(n)         ]) // factorial(n)

def f(n) = a(n+1)

Try it online!

Next sequence

This can easily compute more values than the 31 that OEIS has.

Once again we have a symmetric group acting on nodes, inducing an action on the set of possible edges and on graphs. It acts on the set of self-complementary graphs, but I don't see how to count how many of these are fixed by a given permutation to apply the lemma that is often named after Burnside. So instead I use the formula in the comment of the OEIS entry that says that the number of self-complementary graphs with n nodes is equal to the difference of the number of graphs with n nodes with an even number of edges and with an odd number of edges. The symmetric group acts on these sets of graphs as well. Instead of computing both numbers independently, we will consider the cases of an even number and an odd number of edges in parallel, which will turn out to be simpler and allow optimizations. We'll see that "evaluate the graph polynomial at -1" will lead to the same result.

As usual, we take the sum over the group elements in Burnside's lemma conjugacy class wise, and represent the conjugacy classes by partitions of n. For each conjugacy class, we want to know the difference between the numbers of graphs with an even and odd number of edges that is fixed by a permutation from that class.

Assume we are given a concrete permutation g. The group generated by g acts on the set of possible edges and partitions them into orbits. A graph is fixed by g if for each orbit, it contains either all or none of its edges. Let's look at the orbits. Each edge in one orbit has its endpoints in the same two (possibly same) cycles of g.

Let's first assume the endpoints are from the same cycle of length k>=2. If k is odd, then there are (k-1)/2 orbits of length k. If k is even, then there are k/2-1 orbits of length k and one of length k/2 (for example, if g contains the cycle (123456), then the there is an edge orbit of size 3 containing {1,4}). Note that we get all orbits of even size exactly when k is a multiple of four.

Next consider the case that the endpoints are from different cycles of lengths k and l. Then the orbit has size lcm(k,l), and there are gcd(k,l) such orbits.

In order to combine all the possibilities, consider the product, for each edge orbit, of 1+x^r, where r is the size of the corresponding orbit. The coefficient of x^s of the product gives the number of graphs that are fixed by g and have s edges. We want the sum of the coefficients at even exponents minus the sum of them at odd coefficients, which we get by evaluating the polynomial at x=-1.

If we kept the polynomials and added them together, we'd get the graph polynomial. Instead, we don't even create these polynomials, but do the substitution immediately. For an edge orbit of even size, we get a factor of 2, for an odd size we get 0. (There is also a direct combinatorial argument that if there is an edge orbit of odd size then there are as many fixed graphs with an even number of edges as there are with an odd number of edges. And the factor 2 corresponds to the choice of including the edges of one orbit to the fixed graph or not).

So, by the considerations about edges with points from only one cycle, we get a difference of 0 whenever g contains a cycle of odd length greater than one, or a cycle of even length not divisible by four. We also get a difference of 0 whenever g contains at least two fixed points (cycles of length one).

This means we only need to sum over conjugacy classes with at most one fixed point and all other cycle lengths multiples of four. sparts computes the corresponding partitions of n. There are none unless n is of the form 4k or 4k+1, so in the other cases there are no self-complementary graphs, which can also easily seen by noting that in these cases the total number of possible edges is odd. But this observations alone doesn't lead to the optimization of only considering special partitions, of which there are only as much as there are partitions of k.

ccSize computes the size of a conjugacy class with given cycle lengths. edgeorbits computes the number of edge orbits of the action of the group generated by a permutation with the given cycle lengths, assuming they are of the special form. In the general case, samecyc, the number of edge orbits with edges that have both nodes from the same cycle, could not be calculated like this. (When I wrote the code, I didn't notice that it only depends on n in the relevant cases.)

a puts everything together, and f fixes the different indexing.

252. Pari/GP, 251 bytes, A000269

A000081(n) = if( n<3, if(n<1,0,1) , 1/(n-1)*sum(k=1,n-1,sumdiv(k,d,d*A000081(d))*A000081(n-k) ) );

gfA81(n) = sum( i=0, n, A000081(i)*x^i, O(x^(n+1)) );

gfA269(n) = {Bx = gfA81(n); Bx^3 * (3-2*Bx) / (1-Bx)^3}

A000269(n) = polcoeff(gfA269(n+3), n+3)

Next Sequence

Try it online!

This uses the generating function formula, by directly computing values of the sequence A000081.

251. C (tcc), 269 bytes, A000711

long p(int k,int n,int*a,int l){long s=1;if(n<1)return!l;a[l]=n;for(int i=1,c,j;i<=k;i++){for(j=0,c=1;j<=l;j++)if(a[j]==i)c++;s*=(i<5)?((c)*(c+1)/2):c;}for(int i=(l==0)?1:a[l-1];i<=n/2;i++)a[l]=i,s+=p(k,n-i,a,l+1);return s;}long a(int n){int a[1000];return p(n,n,a,0);}

Try it online!

Next sequence!

Explanation

// Takes a partition a of the number k and returns how many different
// partitions it represents if the numbers can have many kinds, according
// to the specification of the sequence. For example:
// [1 1 1] =>
//    [1  1  1 ]
//    [1  1  1']
//    [1  1' 1']
//    [1' 1' 1']
//    [1' 1' 1"]
//    [1' 1" 1"]
//    [1" 1" 1"]
// Each different number in the partition can be processed separately,
// and the "score" will be the product of the scores of each number.
long score(int k, int length, int * a){
    long product = 1;

    for(int i = 1;i <= k;i++){ // A partition of k can contain numbers [1,k]
        int count = 0; // Count how many times the number i appears
        for(int j = 0;j <= length;j++){
            if(a[j] == i) c++;
        }

        if(i < 5){
            // i has 3 kinds. If you sort all the cases in ascending
            // "kind numbers", then the first Kind 2 (') can be in
            // (number of Kind >= 1, i. e. the variable c) + 1 positions:
            //    1  1  1
            //    1  1  1'
            //    1  1' 1'
            //    1' 1' 1'
            // Then, the first Kind 3 (") can be in (number of Kind >= 2) + 1
            // positions:
            //    1' 1' 1'
            //    1' 1' 1"
            //    1' 1" 1"
            //    1" 1" 1"
            // If you think about it, you'll get the sum of natural numbers
            // from 1 to (c + 1), for which there is a nice closed form
            // formula (look at sequence of answer number 1, don't forget
            // to rate the language choice 😉) (one problem Emoji solved
            // is ending a parenthesis with an emoticon).
            product *= ((c + 1) * (c + 2)) / 2;
        }else{
            product *= (c + 1);
        }
    }

    return product;
}

// A recursive function that enumerates all partitions of n, scores each
// and returns the sum of all scores. The partitions are generated at
// (a + level)
// Pseudocode algorithm:
// def partitions(n):
//     yield [n]
//     for i in range(1, n):
//         for p in partitions(n - i):
//             yield [n] + p
// Notice how we don't really need to check the whole range of [1, n)
// k is only relevant for scoring
// the partitions are generated at (a + level)
long partitions(int k, int n, int * a, int level){
    if(n < 1){
        if(l == 0){
            return 1; // l == 0 => this is the top level call, so include
            // the case of []
        }else{
            return 0; // doesn't happen, but I think this is the best
            // way to handle this edge case
        }
    }

    a[l] = n;
    long score_sum = score(k, l + 1, a);

    int start;

    if(l == 0){
        start = 1;
    }else{
        start = a[l - 1];
    }

    for(int i = start;i <= n/2;i++){
        a[l]=i;
        score_sum += partitions(k,n-i,a,l+1);
    }

    return score_sum;
}

long a(int n){
    // the longest partition of k is [1]*k, speaking Python,
    // so let's not bother with dynamic allocation
    int a[1000];
    return partitions(n, n, a, 0);
}

157. C (gcc), 376 bytes, A002466

int f(int n)
{
    int i = 0, s[100] = {0};
    s[0] = 1;
    s[1] = 1;
    s[2] = 2;

    while (i < 97) {
        if ((i % 5) == 3) {
            s[3+i] = s[i] + s[2+i];
        }
        else if ((i % 5) == 4) {     
            s[3+i] = s[1+i] + s[2+i];
        }
        else {
            s[3+i] = s[i] + s[1+i] + s[2+i];
        }
        i++;
    }

    return s[n];
}

It's like an obnoxious Fibonacci! 0-indexed.

Next sequence

Try it online!

The function for this sequence said this:

a(1) = a(2) = 1, a(3) = 2, a(5*k+2) = a(5*k+1) + a(5*k-1), a(5*k+3) = a(5*k+2) + a(5*k+1), a(5*k+b) = a(5*k+b-1) + a(5*k+b-2) + a(5*k+b-3) for b=-1,0,1

It's completely unhelpful. However, I noticed that the integers in the sequence were usually the previous three terms added together, but more obnoxious. Here's my work:

1.  1,    1,    2    -> 4    (ok)
2.  1,    2,    4    -> 7    (ok)
3.  2,    4,    7    -> 13   (ok)
4.  4,    7,    13   -> 17   (no) sum does not include second value
5.  7,    13,   17   -> 30   (no) sum does not include first value
6.  13,   17,   30   -> 60   (ok)
7.  17,   30,   60   -> 107  (ok)
8.  30,   60,   107  -> 197  (ok)
9.  60,   107,  197  -> 257  (no) sum does not include second value
10. 107,  197,  257  -> 454  (no) sum does not include first value
11. 197,  257,  454  -> 908  (ok)
12. 257,  454,  908  -> 1619 (ok)
13. 454,  908,  1619 -> 2981 (ok)
14. 908,  1619, 2981 -> 3889 (no) sum does not include second value
15. 1619, 2981, 3889 -> 6870 (no) sum does not include first value

So for each five terms, the last two would be calculated differently. The modulo's and if-statements in the while loop of the code handle that.

249. PicoLisp, 171 bytes, A000904

(de a000904 (n)
 (cond
  ((= n 0) 0)
  ((= n 1) 3)
  ((= n 2) 13)
  (T 
  (+ (* (+ n 2) (a000904 (- n 1)))
     (* (+ n 3) (a000904 (- n 2)))
	 (a000904 (- n 3)))
  )
 )
)

Try it online!

next sequence

Woo! eleventh page!

248. Huginn, 904 bytes, A000087

import Algorithms as alg;

gcd( a_, b_ ) {
 u = integer( a_ );
 v = integer( b_ );
 while ( v > 0 ) {
    t = u;
    u = v;
    v = t % v;
  }
  return( u );
}

eulerPhi( n_ ) {
 n = integer( n_ );
 x = 0;
 for ( i : alg.range( 1, n + 1 ) ) {
  if ( gcd( i, n ) == 1 ) {
   x += 1;
  }
 }
 return ( x );
}

binomial( n_, k_ ) {
 n = integer( n_ );
 k = integer( k_ );
 x = 1;
 for ( i : alg.range( 1, k + 1 ) ) {
  x = x * (n - i + 1) / i;
 }
 return ( x );
}

A000087( n_ ) {
 n = integer( n_ ) + 1;
 z = 0.0 ;
 for ( k : alg.range( 1, n ) ) {
  if ( n % k == 0 ) {
   z += real( eulerPhi( n / k ) * binomial( 3 * k, k ) );
  }
 }
 z += real( ( n + 2 ) * binomial( 3 * n, n ) ) / real( ( 3 * n - 2 ) * ( 3 * n - 1 ) );
 z = z / real( 3 * n );
 if ( n % 2 == 1 ) {
  z += real( 2 * ( n + 1 ) * binomial( 3 * ( n + 1 ) / 2, ( n + 1 ) / 2 ) ) / real( 3 * ( 3 * n - 1 ) * ( 3 * n + 1 ) );
 }
 return( z );
}

Next Sequence

Try it online!

This uses the formula from the OEIS page, which is a little complicated, but not too hard once you break it down.

247. Enlist, 87 bytes, A000240

RṖ†eṢS=1§€S                                                                            

Try it online!

Next sequence.


Explanation:

 Ṗ           All permutations of
R            the ranges from 1 to n.
  †     §€   For each of them
   eṢ        Calculate the equality of that list with the sorted list (which is the range from 1 to n)
     S       Sum. Now the value is the number of fixed point of that permutation.
      =1     Return 1 if the number of fixed point is 1, and 0 otherwise.
         S   Sum of the values -> number of permutations such that number of fixed point is 1.

246. Coconut, 240 bytes, A001272

import math

def p(a): return not (a < 2 or any(a % x == 0 for x in range(2, int(a**0.5) + 1)))

def A(n):
 m=n+1
 i=k=0
 while k<m:
  i= i + 1
  x=0
  for j in range(1,i+1):
   x = x+(-1)**(i-j)*math.factorial(j)
  if p(x): k=k+1
 return i

Next Sequence

Try it online!

245. Java 7, 1272 bytes, A001524

import java.util.*;

public class Main {
	public static List<List<Long>> partitions(long val) {
		List<List<Long>> list = new ArrayList<>();
		if (val == 0) {
			List<Long> sublist;
			list.add(sublist = new ArrayList<>());
		} else {
			for (int i = 1; i <= val; i++) {
				for (List<Long> ext : partitions(val - i)) {
					List<Long> sublist;
					list.add(sublist = new ArrayList<>());
					sublist.add((long) i);
					sublist.addAll(ext);
				}
			}
		} return list;
	}

	public static List<List<Long>> filter(List<List<Long>> partitions) {
		List<List<Long>> list = new ArrayList<>();
		outerloop: for (List<Long> sublist : partitions) {
			for (int i = 0; i < sublist.size() - 1; i++) {
				if (sublist.get(i) <= sublist.get(i + 1)) continue outerloop;
			} list.add(sublist);
		} return list;
	}

	public static long variants(List<Long> stack) {
		int variants = 1;
		for (int i = 0; i < stack.size() - 1; i++) {
			variants *= stack.get(i) - stack.get(i + 1);
		} return variants;
	}

	public static long A001524(long val) {
		long out = 0;
		for (List<Long> stack : filter(partitions(val))) out += variants(stack);
		return out;
	}

	public static void main(String[] args) {
		for (long i = 0; i < 10; i++) {
			System.out.println(i + ": " + A001524(i));
		}
	}
}

Try it online!

This isn't too slow though it probably could be improved. This sequence was fairly simple but 1272 bytes because Java.

Next Sequence

244. UCBLogo, 1524 bytes, A000112

to permutations :list
    if :list = [] [op [[]]]
    op map.se [
        map [[ls] fput ? :ls] permutations (remove ? :list)
    ] :list
end

to dfs :node
    repeat :N [
        if and
        (1 = item :node item repcount :matrix) 
        not(item repcount :visited) 
        [
            setitem repcount :visited "true
            dfs repcount
        ]
    ]
end

to tuples :items :n
    if :n = 1 [op map "list :items]
    op (crossmap "fput :items tuples :items :n-1)
end

to isomorphic :mat1 :mat2 ; they must both have size N*N
    foreach permutations iseq 1 :N [
        catch "failed [
            for [i 1 :N] [
                for [j 1 :N] [
                    if (
                            (item      :i    item       :j    :mat1)  
                            item (item :i ?) item (item :j ?) :mat2
                    ) [throw "failed]
                ]
            ]
            op "true
        ]
    ]
    op "false
end

to solve :N
    if :N = 0 [op 1]

    localmake "visited array :N
    localmake "matrices []
    local "valid

    foreach tuples (tuples [0 1] :N) :N [ [matrix]
        make "valid "true
        for [node 1 :N] [
            repeat :N [
                setitem repcount :visited "false
            ]
            dfs :node

            if (item :node :visited) [
                make "valid "false
                throw "for.catchtag ; FMSLogo-specific way to break for loop
                ; because Logo doesn't have Break command.
            ]
            repeat :N [
                if and (item repcount :visited) (0 = item :node item repcount :matrix) [
                    make "valid "false
                    throw "for.catchtag
                ]
            ]
        ]

        if :valid [
            catch "nextmatrix [
                foreach :matrices [
                    if isomorphic :matrix ? [throw "nextmatrix]
                ]
                make "matrices fput :matrix :matrices
            ]
        ]
    ]
    op count :matrices
end
       

Next sequence.

There are 7 spaces in the last line.

You can try it online here. Just enter the program and append print solve 3 (for example) in the end.

I choose UCBLogo for this sequence because I don't want to use FMSLogo, which I want to keep for a more geometry-related sequence.

So, in the end I gave up and just post my bruteforce solution.

This one takes a long time to calculate for just n=4. The MD5 I mentioned in the chat is for the version with some spaces at the end removed.


Explanation:

First, the program generates all possible N×N matrices tuples (tuples [0 1] :N) :N. Each matrix represent a directed graph with N vertices.

For each matrix (store in variable matrix, it checks whether it represents a poset (Two vertices A and B has the edge A→B connected if and only if A<B) by: for each node, it runs a DFS from that node, and verify that it can't reach that node (there is no cycle in the graph), and there is an edge from the node to every reachable nodes (because < is transitive).

After having checked that the matrix represents a valid poset, the program checks whether it is isomorphic to any existing poset, stored in the matrices variable. If it is not, the program put :matrix to the first of the variable :matrices (make "matrices fput :matrix :matrices).

Then in the end the program output the number of elements of :matrices (op count :matrices).

153. Emojicode, 1344 bytes, A000136

🐋🍨🍇
 👴 Find the index of e in the list by comparing the elements with c
 🐖🔎e Element c🍇Element Element➡👌🍉➡🍬🚂🍇
  🔂i⏩0🐔🐕🍇 🍊🍭c e🍺🐽🐕i🍇🍎i🍉🍉
  🍎⚡
 🍉
🍉

🐇☯🍇
 👴 Checks whether a permutation is a possible way to fold stamps
 🐇🐖🅱p🍨🐚🚂➡👌🍇
  🔂k⏩0➖🐔p 1🍇
   🔂r⏭🚮k 2➖🐔p 1 2🍇
    🍦c🍇a🚂b🚂➡👌🍎😛a b🍉
    🍦A🍺🔎p k c
    🍦B🍺🔎p r c
    🍦C🍺🔎p➕k 1 c
    🍦D🍺🔎p➕r 1 c
    🍊🎉🎉🎉🎊🎊◀A B◀B C◀C D🎊🎊◀B C◀C D◀D A🎊🎊◀C D◀D A◀A B🎊🎊◀D A◀A B◀B C🍇🍎👎🍉
   🍉
  🍉
  🍎👍
 🍉

 👴 Iterates over the permutations
 🐇🐖🅰n🚂➡🚂🍇
  🍦a🔷🍨🐚🚂🐧n
  🍦c🔷🍨🐚🚂🐧n
  🔂i⏩0 n🍇
   🐷a i i
   🐷c i 0
  🍉

  🍮i 0
  🍮r 1
  🔁◀i n🍇
   🍊◀🍺🐽c i i🍇
    🍮j 0
    🍊😛🚮i 2 1🍇🍮j🍺🐽c i🍉
    🍦t🍺🐽a j
    🐷a j🍺🐽a i
    🐷a i t
    🍊🍩🅱☯a🍇🍮➕r 1🍉
    🐷c i➕1🍺🐽c i
    🍮i 0
   🍉🍓🍇
    🐷c i 0
    🍮➕i 1
   🍉
  🍉
  🍎r
 🍉
🍉

🏁🍇
 🍊🍦i🚂🔷🔡😯🔤🔤10🍇
  😀🔡🍩🅰☯➕1 i 10
 🍉
🍉

Try it online!

Next sequence!

I was going to use something esoteric, but then I changed my mind. Pretty self explanatory, I don't think an explanation is necessary.

Note: for inputs larger than 7, you have to specify a heap size larger than 512 MB during the compilation of the Real-Time Engine. For example, use cmake .. -DheapSize=1073741824 for 1 GB. If you run out of heap space, the VM segfaults, probably because someone does not check for NULL after malloc.

Edit: make this faster and less memory-hungry. Now I wonder whether the garbage collector is working properly

Edit almost 2 months later: this code had to work around a bug in the implementation of the ⏩ type. Now that this bug is fixed and TIO updated, I had to offset the range parameters again. I also managed to add some comments, all while keeping the bytecount the same.

243. Ly, 112 bytes, A000111

1<<<<111<n2-0G*
[
 >&s0>l>lr>1>&s>lp
 [
  sp<l+sp<l>>
 ]
 <p<1&s>l<
 [
  sp<l*sp<l*sp<l+>>>
 ]
 <p<p<<,
]
p>u&p;

Try it online!

Next sequence

This uses the recurrence a(n) = Sum_{i=0..n-2} binomial(n-2,i)*a(i)*a(n-1-i).

Using the recurrence for one value needs all the binomials from one row in Pascal's tringle, and then the next value needs the next row, so we compute one row from the previous one by addition, avoiding factorials and divisions, so Ly will stay in the realm of integers and not switch to floats.

Ly uses an infinite strip of stacks, of which we're using seven. For reference, let's call them, from left to right: count, vals, oldvals, oldvalsR, bins, oldbins, and oldbinsT. The stack that we are at in the beginning will be used as oldbins, just because this is the rightmost that needs initialisation. We can move between the stacks with < and >.

We initialise oldbins with 1, the first row of Pascal's triangle. Then we initialise vals with the first three values, which are all 1. Next, we read the input into count and subtract 2, then 0G* will turn that into 0 if it was negative.

Now count tells us how many more values we need. Next we'll have a loop with this loop invariant: vals contains some initial values of the series, we are at count which holds one nonnegative number that tells how many more values are needed, oldbins contains the row of Pascal's triangle that was used for the last value, and the other stacks are empty.

(We didn't really use the first row of the triangle, but we would have needed it if we had computed a(2) from the recurrence. We don't start with only two values, because there is no 0th row from which we can compute the first without complicating the algorithm. We could also store the row we need next, but then we would needlessly compute one row more than needed.)

The looping construct [...] loops while the stack is not empty and its top element isn't zero. The outer loop will be terminated when count is zero, all other loops will be terminated by empty stacks.

To prepare for the work in the loop, we copy the vals stack to the backup cell using &s, then add a zero to this stack as initial value for the sum. Then we store the value of the backup cell to oldvals (with l) and also to oldvalsR, where we reverse it with r. Then we push the first value 1 of the new row of Pascal's triangle to bins, copy oldbins to oldbinsT and drop its first element there (with p).

We can think of the computation of bins as equivalent to this Haskell computation:

[1] ++ zipWith(+) oldbins oldbinsT ++ [1]   where oldbinsT = tail oldbins

The inner loop then copies (s) the top element from oldbinsT to the backup cell and drops it from the stack (p), and puts it on top of the oldbins stack, where it is added to the former top element. This sum is then moved (again with sp<l) to the bins stack. The loop body is completed by going back to the oldbinsT stack. (Note that at the first iteration of the outer loop, this loop will terminate immediately.)

After this loop, the remaining value from oldbins is dropped, and the final 1 value appended to bins. Then bins is copied to oldbins.

The second inner loop is like this Haskell code:

sum ( zipWith3 (\a b c->a*b*c) oldvals oldvalsR bins )

Note that bins has one value less than the two other stacks, so we use this to control the loop. In it, we move the top value to oldvalsR and multiply, then move the result to oldvals and multiply again. This product is moved to vals and added to the accumulated sum on its top. (Remember that we already pushed a zero here.)

When the loop is done, we drop the remaining values from oldvalsR and oldvals and decrement count (with ,).

When the outer loop is done, we needlessly drop the zero from count and output (and drop) the top element from vals. Finally, we delete this whole stack with &p and explicitely end the program with ;. We don't need both, but if we didn't do either, implicit output would print all values from vals.

242. FriCAS, 111 bytes, A000230

a: (Integer) -> Integer
a(n) ==
 i:=2
 repeat
  j:=nextPrime(i)
  if j-i = 2*n or n = 0 then
   return i
  i:=j

Try it online here

Next Sequence

Pretty straightforward.

241. Trefunge-98 (PyFunge), 230 bytes, A000256

       v   >51>R1-:v>RRO:8*'+-*'9+*O3*9-2Pv
>4      (&:|  \    >|v   ;>v;      <:R: -4<
^"FRTH"<@.1<  +  @.$<>R1-:|>\1-RO*\^
 ^ useful     1     v\0\$$< A000256
 library      \     >:1-:v >\:v
O:8*'3-*'Q+/4/^     ^    _$^ *_$/7*\-

Try it online!

Next sequence!

To understand this monstrosity, you first need a quick primer on Funge:

       v
>4      (
^"FRTH"<

You can see that immediately the execution is redirected on the string "FRTH". Because the execution goes right to left, 70 (F) is on the top of the stack. Then the number 4 is pushed and ( loads the fingerprint.

Fingerprints are similar to libraries from other languages, except they are not created in Funge, which would make them more of a language extension. Fingerprints change the semantics of the commands A through Z, which normally all act like r (reflect). You can load fingerprints using (, which more or less pops the number of characters the fingerprint code takes and then pops the characters themselves.

The FRTH fingerprint stands for FORTH, because it includes some useful stack manipulation primitives that originated from FORTH. This program uses the following of them:

   >51>R1-
(&:|  \
@.1<  +

After loading the fingerprint, & inputs a number and pushes it on the stack. : is used to duplicate it because | consumes one copy. | is the vertical conditional. If the number it consumed is zero, it's equivalent to v. Otherwise, it acts like ^.

It is used here because the input of zero needs to be a special case - the loop counter would immediately go negative making the loop infinite and OEIS claims that the formula only works for n > 4. If zero is passed, 1 is pushed, . is used to output it and @ ends the program.

You can also see here the beginning of the main loop of the program. The loop begins with R1- and ends with +\. The stack at the beginning of each iteration looks like this: i n a(n-1). i-1 is the number of repetitions the program will do, since it is decremented and compared at the beginning of the loop. n is the index in the sequence of the value we will be computing, while a(n-1) is the previous value. We implement this formula from the OEIS:

a(n) = (1/4)*(7*binomial(3*n-9, n-4)-(8*n^2-43*n+57)*a(n-1)) / (8*n^2-51*n+81)

Let's tackle the main loop itself:

R1-:v>RRO:
    >|
  @.$<

R brings i to the top. Funge doesn't have a decrement instruction, so we subtract 1 explicitly with -. We duplicate the new i with : for testing with |. If we're finished, we will hit the < and execute the following linear code:

$.@    The stack is now: n a(n-1) i
$      Discard i
 .     Output a(n-1)
  @    Exit.

In most cases, however, | will act like ^, which will make the interpreter execute this long stretch of linear code (ignoring the line wrap):

RRO:8*'+-*'9+*O3*9-2P4- The stack is now: n a(n-1) i
RR                      Bury i where it belongs. Stack: i n a(n-1)
  O:                    Copy n to the top and duplicate. Stack: i n a(n-1) n n
    8*                  Multiply by 8. Stack: i n a(n-1) n 8n
      '+                Use the ASCII value of + to push 43 on the stack
        -               Subtract 43. Stack: i n a(n-1) n 8n-43
         *              Multiply. Stack: i n a(n-1) 8n^2-43n
          '9+           Add 57. Stack: i n a(n-1) 8n^2-43n+57
             *          Multiply. Stack: i n (8n^2 - 43n + 57)*a(n-1)
              O         Copy n to the top. Stack: i n (...)*a(n-1) n
               3*9-     Compute 3n-9. Stack: i n (...)*a(n-1) 3n-9
                   2P4- Copy n to the top, compute n-4.
                        Stack: i n (...)*a(n-1) 3n-9 n-4. Notice how the top two
                        elements are the arguments for the binomial.

We will now compute the binomial(n, k) using the following algorithm which I've come up with myself a few sequences before, but it's probably not anything innovative, since it is obvious when you look at the formula. You can also see it in my Boo answer above.

Let's only consider the very top of the stack when considering the algorithm.

v   ;>v;      <:R:
>R1-:|>\1-RO*\^
  \$$<

This is the part before computing the factorial. After :R:, the ; is a bridge, which skips the >v part.

   v   ;>v;      <
:R:>R1-:|>\1-RO*\^ Stack: n k
:                  Duplicate. Stack: n k k
 R                 Rotate. Stack: k k n
  :                Duplicate. Stack: k k n n. The bottommost k is used later.
                   The other k is the loop counter. The topmost n is the number
                   we're multiplying by, while the other n is the partial product.
   >               The loop starts here. Let's rename the variables and ignore
                   the bottom k. Stack: k product n
    R1-            Decrement k. Stack: product n k-1
       :|>         Exit the loop if k-1 is zero. Uses the >v part that is skipped
                   using a bridge
          \1-      Bring n to the top and decrement. Stack: product k-1 n-1
             R     Rotate. Stack: k-1 n-1 product
              O    Over. Stack: k-1 n-1 product n-1
               *   Multiply - extend the partial product.
                   Stack: k-1 n-1 (product)(n-1)
                \  Swap, restoring the stack to the order from the start of the
                   loop. Stack: k-1 (product)(n-1) n-1
                 ^ Jump to the beginning.

When the loop ends, we execute this:

$$\                Stack: k p n-k 0
$$                 Discard the top two elements, we only need the product
  \                Bring k to the top for computing the factorial. Stack: p k

Let's consider the factorial code:

v\0
>:1-:v >\:v
^    _$^ *_$

It consists of two loops. Let's consider the factorial of 4.

0\>:1-:v_$ Stack: 4
0\         Push the marker used in the second loop, swap. Stack: 0 4
  >        The loop starts here
   :1-     Duplicate and decrement. Stack: 0 4 3
      :v_  Duplicate for the comparsion, loop if not 0.
  >        Consider the loop again, with stack: 0 4 3 2 1
   :1-     Duplicate and decrement. Stack: 0 4 3 2 1 0
      :v_  Duplicate for the comparsion and exit the loop.
         $ Discard the top 0. Stack: 0 4 3 2 1

The second loop multiplies the numbers together, while 0 is marking the end.

>\:v_*  Stack: 0 4 3 2 1
>       The loop starts here
 \      Swap. Stack: 0 4 3 1 2
  :v_   If the top element is 0, end the loop
     *  Multiply. Stack: 0 4 3 2
>       Consider the loop again, with stack: 0 4 6
 \      Swap. Stack: 0 6 4
  :v_   (doesn't end the loop)
     *  Multiply. Stack: 0 24
>       Finally, let's see how the loop terminates.
 \      Swap. Stack: 24 0
  :v_   Ends the loop. Stack: 24 0

Let's finish the main loop, since it now consists of only linear code. It is useful to see the formula while following the code:

a(n) = (1/4)*(7*binomial(3*n-9, n-4)-(8*n^2-43*n+57)*a(n-1)) / (8*n^2-51*n+81)

Let's mark the numerator x and the denominator y, to simplify the description.

a(n) = (1/4)*x/y

Keep it mind that when the instruction pointer hits the edge of the Fungespace, it wraps around.

$/7*\-O:8*'3-*'Q+/4/\1+\ Stack: i-1 n (...)*a(n-1) p k! 0
$                        Discard the 0 marker from the factorial loop.
 /                       Divide to compute the binomial.
                         Stack: i-1 n (...)*a(n-1) binomial(3n-9 n-4)
  7*                     Multiply by 7. Stack: i-1 n (...)*a(n-1) 7*binomial
    \-                   Swap and subtract. Stack: i-1 n 7*binomial-(...)*a(n-1)
      O:                 Over, duplicate. Stack: i-1 n x n n
        8*               Multiply by 8. Stack: i-1 n x n 8n
          '3-            Subtract 51. Stack: i-1 n x n 8n-51
             *           Multiply. Stack: i-1 n x 8n^2-51n
              'Q+        Add 81. Stack i-1 n x 8n^2-51n+81
                 /       Divide. Stack: i-1 n x/y
                  4/     Divide by 4. Stack: i-1 n a(n)
                    \1+\ Increment n. Stack: i-1 n+1 a(n), or as the next
                         iteration would call it: i n a(n-1)

240. CHICKEN Scheme, 256 bytes, A000346

(define (factorial x)
(cond
((< x 2) 1)
(else (* x (factorial (- x 1))))))
(define (choose n k)
(cond
((= n 0) 1)(else
(/ (factorial n) (* (factorial k) (factorial (- n k)))))))
(define (a000346 n)
(- (expt 2 (+ 1 (* 2 n))) (choose (+ 1 (* n 2)) (+ n 1))))

Try it online!

Next sequence

226. Java 7, 4903 bytes, A000080

Originally programmed by HyperNeutrino.

import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

abstract interface BooleanCombiner {
	abstract boolean combine(boolean left, boolean right);
}

class Main {
	static void print(boolean[][] matrix) {
		for (boolean[] row : matrix) {
			for (boolean e : row) {
				System.out.print(e ? 1 : 0);
				System.out.print(' ');
			}
			System.out.println();
		}
	}

	static boolean[] combine(boolean[] left, boolean[] right, BooleanCombiner f) {
		assert left.length == right.length;
		boolean[] result = new boolean[left.length];
		for (int i = 0; i < result.length; i++) result[i] = f.combine(left[i], right[i]);
		return result;
	}

	static boolean none(boolean[] row) {
		for (boolean element : row) if (element) return false;
		return true;
	}

	static boolean all(boolean[] row) {
		for (boolean element : row) if (!element) return false;
		return true;
	}

	static int weight(boolean[] row) {
		int weight = 0;
		for (boolean element : row) if (element) weight++;
		return weight;
	}

	static boolean[] DFS(boolean[][] matrix, int node, boolean[] visited) {
		assert visited.length == matrix.length;
		if (visited[node]) return visited;
		visited[node] = true;
		for (int neighbor = 0; neighbor < visited.length; ++neighbor) {
			if (matrix[node][neighbor]) DFS(matrix, neighbor, visited);
		}
		return visited;
	}

	static boolean isConnected(boolean[][] matrix) {
		return all(DFS(matrix, 0, new boolean[matrix.length]));
	}

	static int[][] triples(int length) {
		int[][] triples = new int[length * ~-length * ~-~-length / 6][];
		int index = 0;
		for (int i = 0; i < length; i++) {
			for (int j = i + 1; j < length; j++) {
				for (int k = j + 1; k < length; k++) {
					triples[index++] = new int[] { i, j, k };
				}
			}
		} return triples;
	}

	static boolean isomorphic(boolean[][] a, boolean[][] b) {
		int[] permutation = new int[a.length];
		for (int i = 0; i < permutation.length; ++i) permutation[i] = i;
		while (true) {
			// check here
			boolean maybe_valid = true;
			for (int i = 0; i < permutation.length && maybe_valid; ++i) {
				for (int j = 0; j < permutation.length; ++j) {
					if (a[i][j] != b[permutation[i]][permutation[j]]) {
						maybe_valid = false;
						break;
					}
				}
			}
			if (maybe_valid) {
				return true; // actually valid!
			}
			
			// advance the permutation here. Implement C++'s std::next_permutation
			int j = permutation.length - 1;
			while (j != 0) {
				if (permutation[j - 1] > permutation[j]) --j;
				else break;
			}
			if (j == 0) break; // reached last permutation
			// reverse [j, permutation.length) segment
			for (int k = j, l = permutation.length - 1; k < l; ++k, --l) {
				int tmp = permutation[k]; permutation[k] = permutation[l]; permutation[l] = tmp;
			}
			// find smallest element in [j, permutation.length) that is still larger than permutation[j-1]
			int k = j; // sorry, meaningless variable name;
			while (permutation[k] < permutation[j-1]) ++k;
			int tmp = permutation[j-1]; permutation[j-1] = permutation[k]; permutation[k] = tmp;
		};
		return false;
	}

	static boolean[][] construct (int size, boolean[] mask, int[][] triples_table) {
		assert triples_table.length == mask.length;
		boolean[][] matrix = new boolean[size][size];
		for (int index = 0; index < mask.length; ++index) {
			if (mask[index]) {
				int[] triple = triples_table[index];
				int i = triple[0], j = triple[1], k = triple[2];
				matrix[i][j] = matrix[j][i] = matrix[i][k] = matrix[k][i] = matrix[j][k] = matrix[k][j] = true;
			}
		}
		return matrix;
	}

	
	static List<boolean[][]> calculate (int size) {
		List<boolean[][]> matrices = new ArrayList<>();
		int[][] triples_table = triples(size);
		boolean[] mask = new boolean[triples_table.length];
		while (true) {
			boolean[][] matrix = construct(size, mask, triples_table);
			process_matrix:
			if (isConnected(matrix)) {
				// check if matrix is isomorphic to any existing matrix
				for (boolean[][] existing_matrix : matrices) {
					if (isomorphic(matrix, existing_matrix)) break process_matrix;
				}
				// check if the matrix is minimal
				for (int delete_triple = 0; delete_triple < mask.length; ++delete_triple) {
					if (! mask[delete_triple]) continue;
					mask[delete_triple] = false; // temporarily set to false
					if (isConnected(construct(size, mask, triples_table))) {
						// it is not minimal
						mask[delete_triple] = true; // remember to restore it ... 
						break process_matrix;
					}
					mask[delete_triple] = true; // ... in any condition
				}
				/* it is both minimal and not counted now, */ matrices.add(matrix);
			}
			
			int i = mask.length - 1;
			while (i >= 0 && mask[i]) mask[i--] = false;
			if (i == -1) return matrices; // considered all <mask> possible.
			mask[i] = true;
		}
	}
	
	public static void main(String[] args) {
		System.out.println(calculate(Integer.parseInt(args[0]) + 3).size());
	}
}

Try it online!

Next sequence.

238. LOLCODE, 429 bytes, A000089

HAI 1.2

I HAS A INPUT
GIMMEH INPUT
INPUT IS NOW A NUMBR
INPUT R SUM OF INPUT AN 1

I HAS A COUNT ITZ 0
I HAS A INDEX ITZ 1
I HAS A TEMP ITZ 0

IM IN YR LOOP
TEMP R PRODUKT OF INDEX AN INDEX
TEMP R SUM OF TEMP AN 1
TEMP R MOD OF TEMP AN INPUT

BOTH SAEM TEMP AN 0
O RLY?
 YA RLY
  COUNT R SUM OF COUNT AN 1
OIC

BOTH SAEM INDEX AN INPUT
O RLY?
 YA RLY
  GTFO
OIC

INDEX R SUM OF INDEX AN 1
IM OUTTA YR LOOP

VISIBLE COUNT
KTHXBYE

Next Sequence

Try it online!

This just directly counts the solutions. None of that Legendre symbol nonsense.

237. M, 89 bytes, A000341

‘ḤŒ!s€2Ṣ€Ṣ$€QS€ÆPa/$$ÐfL                                                                 

Try it online!

Explanation

‘ḤŒ!s€2Ṣ€Ṣ$€QS€ÆPa/$$ÐfL  Main Link
‘                         Increment (for 0-indexing)
 Ḥ                        Double
  Œ!                      All permutations of {1 .. 2n} (implicit range)
    s€2                   Slice each permutation into subslices of length 2
          $€              For each subconfiguration
       Ṣ€                 Sort each pair
         Ṣ                Then sort the entire thing
            Q             Then remove duplicates
                   $$Ðf   Filter pairings using the last three links as a condition
                 a/       All (reduce over logical AND because M doesn't have the ALL builtin)
             S€           Sums
               ÆP         Are Prime
                       L  How many pairings are there?

There are a bunch of spaces at the end

Next Sequence

236. Axiom, 341 bytes, A003295

qpc(n,k) ==  -- inspired by 3rd PARI code for A010815
  qr := divide(n,k)
  if qr.remainder>0 then return 0
  sq := perfectSqrt(24*qr.quotient+1)
  sq case "failed" => 0
  jacobi(12,sq)

qp(k) == series(n+->qpc(n,k),'q=0)

q := series q

F := q*qp(3)*(qp(33)/(qp(1)*qp(11)))

s := q*(-11+(1+3*F)^2*(1/F+1+3*F))

f(n) == coefficients(s).(n+1)

Next sequence.

Put it in a file called a003295.input and, at the axiom prompt, type )read a003295. Now you can for example call f 25. The first time it will give a warning before still giving the correct result. Here it is computing the first values:

(9) -> [f n for n in 0..20]
   Cannot compile map: f 
   We will attempt to interpret the code.

   (9)
   [1, - 5, 17, 46, 116, 252, 533, 1034, 1961, 3540, 6253, 10654, 17897, 29284,
    47265, 74868, 117158, 180608, 275562, 415300, 620210]
                                              Type: List(Expression(Integer))

qp(k) computes the series of the q-Pochhammer symbol for q^k. The definition of F and s follows the Mathematica code.

235. Pascal (FPC), 3295 bytes, A000512

4 days passed without anyone answered.

Type
	int = LongInt; // Can be changed to Integer

Var
	n, n_column, matrices_len, i, j, k: int;
	row_values, matrices: Array of array of int;
	row_id, column_sum: Array of int;
	valid: Boolean;

Function next_permutation (var A : Array of int): Boolean;
var x, y, z, temp: int;
begin
	if Length(A) <> n then writeln('Error!!');
	x := Length(A) - 1; // or High(A)
	z := x;
	while (x > 0) and (A[x-1] > A[x]) do Dec(x);
	y := x;
	while y < z do
	begin
		temp := A[z]; A[z] := A[y]; A[y] := temp;
		Inc(y); Dec(z);
	end;
	if (x = 0) then
		Exit(false);
	y := x; temp := A[x-1];
	while A[y] < temp do Inc(y);
	A[x-1] := A[y]; A[y] := temp;
	Exit(true);
end;

Function equivalent (mat1, mat2: int): Boolean;
{ Use highly sub-optimal solution, O(n!^2 x n^2).
  O( n! x n^2 x log(n) ) solution is possible by trying all row permutation
  and sort the columns, and check if the matrices are equal.
  Sort the rows and the columns alternatively does not work, though.
}
var
	xP, yP: Array of int;
	x, y: int;
	different: Boolean;
begin
	SetLength(xP, n);
	SetLength(yP, n);
	for x := 0 to n-1 do
	begin
		xP[x] := x;
		yP[x] := x;
	end;
	repeat
		repeat
			different := false;
			for x := 0 to n-1 do
			begin
				for y := 0 to n-1 do
				begin
					if row_values[matrices[mat1, x], y] <>
					row_values[matrices[mat2, xP[x]], yP[y]] then
					begin
						different := true;
						break;
					end;
				end;
				if different then break;
			end;
			if not different then Exit(true);
		until not next_permutation(xP);
	until not next_permutation(yP);
	Exit(false);
end;

Begin
	Read(n); Inc(n);
	If n < 3 then
	begin
		Writeln(0);
		Halt;
	end;
	SetLength(row_values, (n * (n - 1) * (n - 2)) div 6);
	n_column := 0;
	for i := 0 to n-1 do
		for j := i+1 to n-1 do
			for k := j+1 to n-1 do
			begin
				SetLength(row_values[n_column], n);
				row_values[n_column, i] := 1;
				row_values[n_column, j] := 1;
				row_values[n_column, k] := 1;
				Inc(n_column);
			end;
	// Dynamic array in FP is 0-based
	if n * (n - 1) * (n - 2) <> 6 * n_column then
	begin
		WriteLn('Error!');
		exit();
	end;

	matrices_len := 0;
	SetLength(matrices, 4);

	SetLength(row_id, n);
	SetLength(column_sum, n);
	while true do
	begin
		for i := 0 to n-1 do column_sum[i] := 0;

		for i := 0 to n-1 do
		begin
			for j := 0 to n-1 do
				Inc(column_sum[j], row_values[row_id[i], j]);
		end;

		valid := true;
		for i := 0 to n-1 do
		begin
			if column_sum[i] <> 3 then // column_sum[i] = sum of all values on column i
			begin
				valid := false;
				break;
			end;
		end;
		if valid then
		begin
			if matrices_len = length(matrices) then
				SetLength(matrices, 2 * length(matrices));
			matrices[matrices_len] := copy(row_id, 0, n);
			Inc(matrices_len);
		end;

		i := n - 1;
		while (i <> -1) and (row_id[i] = n_column - 1) do
			Dec(i);
		if i = -1 then
			Break;
		Inc(row_id[i]); Inc(i);
		while i < n do
		begin
			row_id[i] := row_id[i-1];
			Inc(i);
		end;
	end;

	row_id := nil; column_sum := nil;

	k := 0;
	for i := 0 to matrices_len-1 do
	begin
		valid := true;
		for j := 0 to i-1 do
		begin
			if matrices[j, 0] <> -1 then
			begin
				if equivalent(i, j) then
				begin
					valid := false;
					break;
				end;
			end;
		end;
		if valid then
			inc(k)
		else
			matrices[i, 0] := -1;
	end;
	Writeln(k);
End.

Try it online!

Next sequence.

I can easily delete a byte to get this sequence instead (which seems to be much easier to understand), but I didn't do that.

234. Rust, 512 bytes, A000141

fn a(n: i64) -> i64 {
    let mut ret = 0;

    for a in !n..-!n {
        for b in !n..-!n {
            for c in !n..-!n {
                for d in !n..-!n {
                    for e in !n..-!n {
                        for f in !n..-!n {
                            if a * a + b * b + c * c + d * d + e * e + f * f == n {
                                ret += 1;
                            }
                        }
                    }
                }
            }
        }
    }

    return ret;
}

Try it online!

Next sequence.

Nice byte count, eh?

231. Shakespeare Programming Language, 938 bytes, A000086

The Beautiful Story of Solving Quadratic Equations.
Theseus, the mathematician.
Dogberry, his calculator.
Page, to avoid mistakes caused by imperfect mental math.
Mistress Page, to make Page feel less lonely.

     Act XLII: Introducing modulus arithmetic.
    Scene I: Dogberry as a motivational speaker.
[Enter Dogberry and Page]
 Dogberry:
   Listen to your heart!
[Exeunt]

   Scene II: Complex math without complex numbers.
[Exeunt]
[Enter Theseus and Dogberry]
 Theseus:
   You are the remainder of the quotient between the sum of a cat and
   the product of Mistress Page and the sum of Mistress Page and a
   Microsoft and Page. Are you as big as nothing?
 Dogberry:
   If so, you are the sum of yourself and a cat.
[Exit Dogberry]
[Enter Mistress Page]
 Theseus:
   You are the sum of yourself and an angel. Are you as trustworthy as
   Page? If not, let us return to Scene II.
 Mistress Page:
   If so, open your heart.
[Exeunt]

Try it online!

Next sequence!

It's suprisingly hard to introduce words that mean nothing in the statement, so I didn't. Yes, Microsoft has a meaning - in fact, it's a negative noun so it means -1.

230. Cubix, 86 bytes, A001147

................I?1O@.../s;.\...........*...............p..W/..../......?-2q:(*2O..W\p

Try it online!

Next sequence

Expands to the cube:

        . . . .
        . . . .
        . . . .
        . . . .
I ? 1 O @ . . . / s ; . \ . . .
. . . . . . . . * . . . . . . .
. . . . . . . . p . . W / . . .
. / . . . . . . ? - 2 q : ( * 2
        O . . W
        \ p . .
        . . . .
        . . . .

227. C++ (clang), 861 bytes, A004903

Thanks to user202729 for C++ help :)

# include <iostream>
# include <algorithm>
# include <vector>
# include <math.h>

std::vector<int> getsums(std::vector<int> values, int times) {
	if (times == 1) {
		return values;
	} else {
		std::vector<int> results;
		for (int i = 0; i < values.size(); i++) {
			std::vector<int> subs = getsums(values, times - 1);
			for (int j = 0; j < subs.size(); j++) {
				results.push_back(subs[j] + values[i]);
			}
		} return results;
	}
}

// This method is O(log_8(n)) I think.

int main() {
	int input; std::cin >> input;
	int size = (int) pow(input / 8, 0.1) + 1;
	std::vector<int> values;
	for (int i = 0; i <= size; i++) values.push_back(pow(i, 10));
	std::vector<int> sums = getsums(values, 8);
	std:sort(sums.begin(), sums.end());
	sums.erase(std::unique(sums.begin(), sums.end()), sums.end());
	for (int i = 0; i < input; i++) std::cout << sums[i] << " ";
}

Try it online!

My first C++ program that actually does something interesting \o/

Next Sequence

228. Hodor, 361 bytes, A000861

HoDoRHoDoR HODOR 000861(HODOR? ) {
  $HODOR: Hodor? = 0;
  $HODOR: HODOR?! = 0;
  hodor............ (Hodor? < HODOR? ) {
    HODOR?! = HODOR?! +1;
    $HODOR: d = HODOR?! % 10;
    $HODOR: h = HODOR?! % 100;
    HOdor!!! ( h==12 || ((h>20 || h<10) && ((d==1) || (d==2) || (d==3) || (d==5) || (d==9)))) {
      Hodor? = Hodor? +1;
    }
  }
  HODOR:: HODOR?! ;
}

Next Sequence

Hodor!

225. VBA, 80 bytes, A001232

Sub s(n)
While k<n+1
i=i+1
If i*9=StrReverse(i) Then k=k+1
Wend
MsgBox i
End Sub

Next sequence

Output is a popup message. A not-very-exciting sequence deserves a not-very-exciting solution, I think.

224. Racket, 1232 bytes, A000088

#lang racket

(define (partsm n m)
  (if (= n 0)
      '(())
      (for*/list ([k (range 1 (add1 (min n m)))]
                  [r (partsm (- n k) k)] )
        (cons k r) ) ) )

(define (parts n)
  (partsm n n) )

(define (fact n)
  (for/product ([i (range 1 (add1 n))]) i) )

(define (c2 n) ; ways to choose 2 elements from n
  (* n (sub1 n) 1/2) )

(define (cycHash cl)
  (let ([h (make-hash)])
     (for ([i cl])
       (hash-update! h i add1 0) )
   h ) )

(define (halfes ch)
  (for/hash ([(l m) ch]
             #:when (even? l) )
    (values (/ l 2) m) ) )

(define (centralizerSize ch)
  (for/product ([(l m) ch])
    (* (expt l m) (fact m)) ) )

(define (fixp ch n)
  (for/sum ([(l m) ch]
            #:when (= (remainder n l) 0) )
    (* l m) ) )

(define (s2orb hch n)
  (for/sum ([(hl m) hch]
            #:when (let-values ([(q r) (quotient/remainder n hl)])
                     (and (= 0 r) (odd? q)) ) )
    (* hl m) ) )

(define (edgeOrbs ch)
  (let* ([hch (halfes ch)]
         [order (apply lcm (hash-keys ch))])
    (/ (for/sum ([k order])
         (+ (c2 (fixp ch k)) (s2orb hch k)) )
       order ) ) )

(define (f n)
  (for/sum ([ch (map cycHash (parts n))])
    (/ (expt 2 (edgeOrbs ch)) (centralizerSize ch)) ) )

Try it online!

Next sequence

Yes, it was Burnside's lemma time again! Symmetric group acts on n nodes, inducing an action on the possible edges and on the possible graphs. Count the orbits of the last action, yada yada. Run through the elements by conjugacy classes represented by partitions of n. Number of graphs fixed by an element g is 2 to the number of orbits of edges under the action of the cyclic group generated by g. So use Burnside's lemma again and find the number of edges fixed by each g^k. An edge is fixed if its endpoints are on fixed points or on points that are interchanged by the group element. Feel free to ask for more details!

223. GolfScript, 88 bytes, A000110

{
 # Recurrence a(n+1) = sum a(k) * binomial(n, k)
 [1]{..,({[.(;\);]zip{~+}%}*+}@*-1=
}

Online demo

Next sequence

221. Pony, 670 bytes, A000107

fun b(n: U128): U128 =>
  if n == 0 then
    return 0
  elseif n == 1 then
    return 1
  else
    var result: U128 = 0
    var j: U128 = 1
    
    while j < n do
      var d: U128 = 1
      var t: U128 = 0
      while d <= j do
        if (j % d) == 0 then
          t = t + (d * b(d))
        end
        d = d+1
      end
      result = result + (t * b(n-j))
      j = j+1
    end
    return result / (n-1)
  end

fun a(n: U128): U128 =>
  if n == 0 then
    return 0
  elseif n == 1 then
    return 1
  else
    var result: U128 = 0
    var i: U128 = 1
    while i < n do
      result = result + (a(n-i) * b(i))
      i = i+1
    end
    return result + b(n)
  end

Next Sequence

Try it online!

220. Visual Basic .NET (.NET Core), 107 bytes, A000127

Function A000172(n As Integer) As Integer
n += 1
Return(n^4 - 6*n^3 + 23*n^2 - 18*n + 24) / 24
End Function

Try it online!

Next Sequence

Note that the implementation of VB.NET on TIO does not have BigIntegers (I tried it and it wants a .dll) so I can use You can assume that neither the input nor the required output will be outside your languages numerical range, but please don't abuse this by choosing a language that can only use the number 1, for example.

219. Maxima, 127 bytes, A000702

load("ratpow")$
p(n):=num_partitions(n);
q(n):=ratp_dense_coeffs( product(1+x^(2*k-1),k,1,n) ,x)[n];
a(n):=(p(n+2)+3*q(n+3))/2;

Next Sequence

Try it online!

This uses the first formula on the OEIS page, with a built-in for p and the generating function for q. It's basically the same as the Mathematica code.

208. Befunge 93, 75 bytes, A000389

&:5-v
vp00<v`g00<
    v_:v
    >1 >/v:
>:1-:v v*<^_$5432***/.@
^    _$> \:^

Try it online!

Next sequence

Since it has been pointed out that MATLAB might be is overkill for such a simple sequence I decided to give Befunge a try, and free MATLAB for future use.

Hoping it's not against the rules I'm changing the language of my answer maintaining the same bytecount.

218. ExtraC, 702 bytes, A000174

long N be readint
long R be 0
for(long A be 0 AND not(A times A greater N) AND increment A)do
  for(long B be A AND not(A times A plus B times B greater N) AND increment B)do
    for(long C be B AND not(A times A plus B times B plus C times C greater N) AND increment C)do
      for(long D be C AND not(A times A plus B times B plus C times C plus D times D greater N) AND increment D)do
        for(long E be D AND not(A times A plus B times B plus C times C plus D times D plus E times E greater N) AND increment E)do
          if(A times A plus B times B plus C times C plus D times D plus E times E equals N)do
            increment R
          end
        end
      end
    end
  end
end

print(R)

Try it online!

Next sequence!

212. JavaScript (SpiderMonkey), 79 bytes, A000078

a = n => n < 3 ? 0 : n == 3 ? 1 : a(--n) + a(--n) + a(--n) + a(--n)

// balloon

Try it online!

Next sequence.

217. Mathematica, 174 bytes, A000411

L[a_, s_] := Sum[JacobiSymbol[-a, 2k + 1] / (2k + 1)^s, {k, 0, Infinity}]
d[a_, n_] := L[-a, 2n] * (2a / Pi)^(2n) / Sqrt[a] * (2n - 1)!
A000411[n_] := Round @ N @ d[6, n + 1]

Try it online!

Next sequence.

Note that this takes 30 seconds for n = 2 on TIO. Paper that was both useful and useless at the same time.

216. BeanShell, 411 bytes, A000095

J(a,b){if(b<=0||(b%2)==0) return 0;j=1;if(a<0){a=-a;if((b%4)==3)j=-j;}while(a!=0){while((a%2)==0){a/=2;if((b%8)==3||(b%8)==5)j=-j;}t=a;a=b;b=t;if((a%4)==3&&(b%4)==3)j=-j;a=a%b;}if(b==1)return j;return 0;}n=new Scanner(System.in).nextInt()+1;l=(n==1)?1:0;if(n%4>0){l=(n%2>0)?1:2;for(d=3;d<=n;d+=2){if(n%d>0)continue;P=true;for(p=3;p*p<=d;p+=2)if(d%p==0){P=false;break;}if(!P)continue;l=l*(1+J(-1, d));}}print(l);

Also prints the input for some reason. I don't think it's possible to fix it

Try it online!

Next sequence!

214. Julia 0.4, 383 bytes, A000117

Because of sequence relationships, I've implemented A000013 four times now.

function EulerPhi(n)
  x = 0
  for i = 1:n
    if gcd(i,n) == 1
      x = x + 1
    end
  end
  return x
end

function A000013(n)
  if n <= 1
    return 1
  end
  x = 0
  for d = 1:n
    if n/d == n÷d
      x = x + (EulerPhi(2*d) * 2^(n/d))/(2*n)
    end
  end
  return x
end

function A000011(n)
  return (A000013(n) + 2^(n÷2))/2
end

function A000117(n)
  return A000011(2*n)
end

Next Sequence

Try it online!

213. Befunge-98 (PyFunge), 117 bytes, A000079

v   v2<
    * \
    \ -  did you know that comments in befunge start and end with nothing?
      1
>&1\>:|
      >$.@

Try it online!

Next sequence!

210. Pyth, 76 bytes, A000100

 "This is dummy text. Can be replaced with whatever you want!"l{s.pMfq3eST./

See the first few terms.

Next Sequence.

Explanation

211. 05AB1E, 78 bytes, A000076

2sm©ÝDâεDDн2m4*sP4*+sθ2m5*+}Ùʒ®›1s-}gqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq

Try it online!

Explanation

2sm©ÝDâεDDн2m4*sP4*+sθ2m5*+}Ùʒ®›1s-}gqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq  5
2                                                                               5, 2
 s                                                                              2, 5
  m                                                                             32
   ©                                                                            32 [Copy to register]
    Ý                                                                           [0, ..., 32]
     D                                                                          [0, ..., 32], [0, ..., 32]
      â                                                                         [[0, 0], [0, 1], ..., [32, 31], [32, 32]]
       ε                   }                                                    For each pair [x, y]
        D                                                                       [x, y], [x, y]
         D                                                                      [x, y], [x, y], [x, y] # yes I realize I can triplicate
          н                                                                     [x, y], [x, y], x
           2                                                                    [x, y], [x, y], x, 2
            m                                                                   [x, y], [x, y], x^2
             4                                                                  [x, y], [x, y], x^2, 4
              *                                                                 [x, y], [x, y], 4x^2
               s                                                                [x, y], 4x^2, [x, y]
                P                                                               [x, y], 4x^2, xy
                 4                                                              [x, y], 4x^2, xy, 4
                  *                                                             [x, y], 4x^2, 4xy
                   +                                                            [x, y], 4x^2+4xy
                    s                                                           4x^2+4xy, [x, y]
                     θ                                                          4x^2+4xy, y
                      2                                                         4x^2+4xy, y, 2
                       m                                                        4x^2+4xy, y^2
                        5                                                       4x^2+4xy, y^2, 5
                         *                                                      4x^2+4xy, 5y^2
                          +                                                     4x^2+4xy+5y^2
                            Ù                                                   Now we have a list of all numbers formed by this; uniquify
                             ʒ     }                                            Keep numbers `n` where the result of the codeblock is 1
                              ®                                                 n, 32
                               ›                                                n > 32
                                1                                               n > 32, 1
                                 s                                              1, n > 32
                                  -                                             1 - (n > 32)
                                    g                                           Length; final number of numbers formed
                                     qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq  `q` terminates the program

Next Sequence

209. APL (Dyalog), 100 bytes, A000075

{
    dims ← 1 + 2 * ⍵
    table ← ∘.{+/2 3×⍺ ⍵*2}⍨ ⍳dims
    uniq ← ∪ (dims*2)⍴ table
    +/ (××(2*⍵)≥⊢) uniq
}

using ⎕IO←0.

Try it online!

Next sequence

206. Proton, 3275 bytes, A000109

# This took me quite a while to write; if it's wrong, please tell me and I'll try to fix it without changing the byte count..

permutations = x => {
	if len(x) == 0 return [ ]
	if len(x) == 1 return [x]
	result = []
	for index : range(len(x)) {
		for permutation : permutations(x[to index] + x[index + 1 to]) {
			result.append([x[index]] + permutation)
		}
	}
	return result
}

adjacency = cycles => {
	cycles = cycles[to]
	size = cycles.pop()
	matrix = [[0] * size for i : range(size)]
	for cycle : cycles {
		i, j, k = cycle[0], cycle[1], cycle[2]
		matrix[i][j] = matrix[i][k] = matrix[j][i] = matrix[j][k] = matrix[k][i] = matrix[k][j] = 1
	}
	return matrix
}

transform = a => [[a[j][i] for j : range(len(a[i]))] for i : range(len(a))]

isomorphic = (a, b) => {
	return any(sorted(b) == sorted(transform(A)) for A : permutations(transform(a)))
}

intersection = (a, b) => [x for x : a if x in b]

union = (a, b) => [x for x : a if x not in b] + list(b)

validate = graph => {
	matrix = adjacency(graph)
	rowsums = map(sum, matrix)
	r = 0
	for s : rowsums if s + 1 < graph[-1] r++
	return 2 || r
}

graphs = nodes => {
	if nodes <= 2 return []
	if nodes == 3 return [[(0, 1, 2), 3]]
	result = []
	existing = []
	for graph : graphs(nodes - 1) {
		graph = graph[to]
		next = graph.pop()
		for index : range(len(graph)) {
			g = graph[to]
			cycle = g.pop(index)
			n = g + [(cycle[0], cycle[1], next), (cycle[1], cycle[2], next), (cycle[2], cycle[0], next), next + 1]
			N = sorted(adjacency(n))
			if N not in existing {
				existing += [sorted(transform(a)) for a : permutations(transform(adjacency(n)))]
				result.append(n)
			}
			for secondary : index .. len(graph) - 1 {
				g = graph[to]
				c1 = g.pop(index)
				c2 = g.pop(secondary)
				q = union(c1, c2)
				g = [k for k : g if len(intersection(k, intersection(c1, c2))) <= 1]
				if len(intersection(c1, c2)) == 2 {
					for i : range(3) {
						for j : i + 1 .. 4 {
							if len(intersection(q[i, j], intersection(c1, c2))) <= 1 {
								g.append((q[i], q[j], next))
							}
						}
					}
				}
				g.append(next + 1)
				N = sorted(adjacency(g))
				if N not in existing {
					existing += [sorted(transform(a)) for a : permutations(transform(adjacency(g)))]
					result.append(g)
				}
				for tertiary : secondary .. len(graph) - 2 {
					g = graph[to]
					c1 = g.pop(index)
					c2 = g.pop(secondary)
					c3 = g.pop(tertiary)
					q = union(union(c1, c2), c3)
					g = [k for k : g if len(intersection(k, intersection(c1, c2))) <= 1 and len(intersection(k, intersection(c2, c3))) <= 1]
					if len(q) == 5 and len(intersection((q1 = intersection(c1, c2)), (q2 = intersection(c2, c3)))) <= 1 and len(q1) == 2 and len(q2) == 2 {
						for i : range(4) {
							for j : i + 1 .. 5 {
								if len(intersection(q[i, j], q1)) <= 1 and len(intersection(q[i, j], q2)) <= 1 {
									g.append((q[i], q[j], next))
								}
							}
						}
						g.append(next + 1)
						N = sorted(adjacency(g))
						if N not in existing {
							existing += [sorted(transform(a)) for a : permutations(transform(adjacency(g)))]
							result.append(g)
						}
					}
				}
			}
		}
	}
	return [k for k : result if max(sum(k[to -1], tuple([]))) + 1 == k[-1] and validate(k)]
}

x = graphs(int(input()) + 3)
print(len(x))

Try it online!

Next Sequence

207. ARBLE, 389 bytes, A003275

coprime = eq(max((#table.unpack)(where(range(1,max(a,b)),eq(d%first(a,b,c,d,e),0)*eq(e%a,0),a,b))),1)
phi = len(where(range(1,n),coprime(a,first(n,b,c)),n))
A003275 = list()
local A003275_n = 0
return function(n)
	while(#A003275 < n)do
		A003275_n = A003275_n + 1
		if(phi(A003275_n) == phi(A003275_n+1))then
			A003275[#A003275+1] = phi(A003275_n)
		end
	end
	return A003275[#A003275]
end

Try it online!

Next Sequence

204. Positron, 53 bytes, A000096

f = function {
      return ( $1 * ( $1 + 3 ) ) / 2
}

Try it online!

Next Sequence

shout out to all the New Yorkers here! xD

N.B. The next one can be hardcoded because it is a finite sequence

205. Commata, 109 bytes, A000053

Due to the fact that the proper name breaks the snippet, it has been changed. The proper name is ,,,

14 18 23 28 34 42 50 59 66 72 79 86 96 103 110 116 125 137 145 157 168 181 191 207 215 225 231 238 242 ↺•

Try it online!

Next sequence. (wtf)

Hello darkness,,, my old friend.

203. Julia 0.5, 96 bytes, A000050

function A000050(n)
x = 0:(2^n)
y = x'
z = x.^2 .+ y.^2
z = z[z .<= 2^n]
length(unique(z))-1
end

Try it online!

Next Sequence

Needs the -1 in length(unique(z))-1 because it always includes 0, which is not a positive integer.

202. Oasis, 50 bytes, A000213

bc+d+$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$111

$s are filler.

Try it online!

Next Sequence

196. Java (OpenJDK 9), 56 bytes, A000210

int f(int n) {return (int)Math.floor((n+1)*(Math.E-1));}

Try it online!

Next Sequence

199. Kotlin, 92 bytes, A000466

fun main(args: Array<String>){
    val n = Integer.valueOf(args[0]);
    println(4*n*n-1);
}

Try it online!

Next Sequence

198. Go, 466 bytes, A000347

import . "math"

func A000347(n float64) int {
    result := 0

    n += 4

    for x_1 := 1.0; x_1 < n * n; x_1++ {
        for x_2 := x_1; x_2 < n * n; x_2++ {
            for x_3 := x_2; x_3 < n * n; x_3++ {
                for x_4 := x_3; x_4 < n * n; x_4++ {
                    if Sqrt(x_1) + Sqrt(x_2) + Sqrt(x_3) + Sqrt(x_4) <= n {
                        result += 1
                    }
                }
            }
        }
    }

    return result
}

Try it online!

Next sequence. (Easy.)

197. D, 347 bytes, A000056

import std.stdio, std.conv;

void main(string[] args){
  int n = to!int(readln)+1;
  double x = 1;
  for(int i=2; i<n; i++){
    bool prime = true;
    for(int k=2; prime && k<=i/2; k++)
    {
        if(i%k==0)
        {
            prime=false;
        }
    }
    if(prime && n%i==0) { x = x*(1-1/(cast(double)i*i)); }
  }
  writeln(n*n*n*x);
}

Try it online!

Next Sequence.

Uses the formula a(n)=n*A007434(n), and the formula A007434(n) = n^2*Product_{p|n}(1-1/p^2).

195. ><>, 210 bytes, A000589

5+::6+}2*}5 -{2[\]b*$,n;
//?={:{:/?= 0:  /
:\      >    ~~1v
\{:}-12[v   /~]{ 22[v/~]*$32[v
v       <           <        >
            /:2=    ?/\
            ?
>:?\~11>*l2\
-1:/ v$\?- /
     >  :1) ^   v,$]~ /

Try it here - input given as initial stack
Next sequence

Fixed previous version. Byte count changed so I decided to delete and repost.
For some reason, doesn't work on TIO.

The code has 3 parts:
enter image description here
Red - computing main sequence;
Orange - computing binomial using factorial;
Blue - computing factorial;

191. Haskell, 1824 bytes, A000725

import Data.List (sort, group, permutations)
import Control.Monad (replicateM)
import qualified Data.Set as S
import qualified Data.Map.Strict as M

type V = [Bool]

parts :: Int -> [[Int]]
parts n = partsm n n
  where partsm 0 _ = [[]]
        partsm n m = [ v:p | v <- [1 .. min n m], p <- partsm (n-v) v ]

fact :: Int -> Integer
fact n = product [1 .. fromIntegral n]

centralizerSize :: [Int] -> Integer
centralizerSize cyclens =
  product [ l^m * fact m | ll <- group (sort cyclens),
                           let l = fromIntegral $ head ll,
                           let m = length ll             ]

ccSize :: [Int] -> Integer
ccSize cyclens = fact (sum cyclens) `div` centralizerSize cyclens

repr :: [Int] -> [Int]
repr cyclens = reprh cyclens 0
  where reprh []     _ = []
        reprh (l:ls) m = [m+1 .. m+l-1] ++ [m] ++ reprh ls (m+l)

act_it :: [Int] -> V -> V
act_it p v = [ v!!i | i <- p ]

act_ot :: V -> [Int] -> V -> V
act_ot neg p = zipWith (/=) neg . act_it p

orbit :: ( V -> V ) -> V -> [V]
orbit act x = x : takeWhile (x /=) (iterate act (act x))

orbitLengths :: S.Set V -> ( V -> V ) -> [Int]
orbitLengths o act = sort $ orblens o act
  where orblens o act
          | S.null o  = []
          | otherwise = let orb = orbit act (S.findMin o)
                        in length orb :
                           orblens (S.difference o (S.fromList orb)) act

oeis725 :: Int -> Integer
oeis725 n =
  let v = replicateM n [False,True]
      o = S.fromList v
      m = M.fromListWith (+)
          [ (pcls, centralizerSize pcls * ccSize cls) |
            cls <- parts n,
            let pcls = orbitLengths o (act_it $ repr cls) ]
  in sum [ M.findWithDefault 0 (orbitLengths o (act_ot neg p)) m |
           p <- permutations [0..n-1], neg <- v ]
     `div` ( (fact n)^2 * 2^n )

f n = oeis725 (n+1)

Next sequence

Try it online!

The math behind it

Let V be the set of the 2^n boolean vectors of length n (which is also a group under component-wise xor), and P be the group with the (2^n)! permutations of V. Let S be the symmetric group on n points of size n!. S acts on V by permuting the components, thus embedding S in P. Let IT (for input transformations) be this subgroup of P. For the output transformations OT < P, we combine the action of S and the xor-ing action of V on itself. (Abstractly, it is a semidirect product of V and S. It's order is n!*2^n)

Now let the direct product OT*IT act on P by p(ot,it)=ot^-1*p*it (ot is inverted for formal reasons that are not important here). We want to know how many orbits this action has. To use Burnside's lemma, we need to know how many elements of P are fixed under the action of a particular (ot,it), that is, how many satisfy ot^-1*p*it=p, which is equivalent to p*it*p^-1=ot. So there are only solutions if it and ot are conjugate in P, which means they need to have the same cycle lengths. Then, the number of solutions is the size of the centralizer of it (or ot) in P, which can be computed from the cycle lengths.

Instead of running over all elements of OT*IT and summing the corresponding number of fixed elements, we can run only over OT and sum the product of the number of conjugate elements in IT and the centralizer size. These products can be precomputed for each conjugacy class of IT represented by the cycle lengths.

In GAP I would only run over the conjugacy classes of OT, but here I'm too lazy. This program is already good enough to compute more values than OEIS has.

193. Hodor, 160 bytes, A000326

HODOR! = HoDoRHoDoR( HODOR? ) {
	HOdor!!!(HODOR? == 0)
	HODOR:: 0;
	HODOR = 1;
	Hodor! = 2;
	hodor = 3;
	HODOR:: HODOR? * (hodor * HODOR? - HODOR ) / Hodor! ;
}

Try it online!
Next sequence

It's a little inefficient, but please don't hold it against Hodor. He is a little slow, but he's a beautiful gentle giant.

192. Emoji, 326 bytes, A001824

📥👥🔚📤💬t💬📲💬1💬📥👥💬10💬📥🔀📤⛽👥💬t💬📱🐣🚘⛽👥💬n💬📲🔀👥💬a💬📲🔀👥👪💬4💬📥👪📤👥👫👪🔀💬n💬📱👥👫💬1💬📥🌊👥👪👥👪👪🌊💬a💬📱🔀💬n💬📱📤🚘🔃🔚🐧🐧🔙💬1💬📥🐧➡

Try it online!

Next sequence!

Abuses 📥 (floor) to convert a string to a number and 📤 (ceil) to increment. Also uses ints instead of booleans in conditionals, but the interpreter does seems to be okay with it. Uses the following formula: a(n) = 2*(4*n^2+1)*a(n-1) - (2*n-1)^4*a(n-2). The program operates on integers, but the language specification looks like only floats were supposed to be available. This allows computing the sequence infinitely without accuracy problems as the interpreter is implemented in Python.

190. COBOL (GNU), 725 bytes, A001182

       IDENTIFICATION DIVISION.
       PROGRAM-ID.  A001182.
       AUTHOR.  KSmarts.

       DATA DIVISION.

       WORKING-STORAGE SECTION.
       01  Num1                                PIC 999   VALUE ZEROS.
       01  Num2                                PIC 999   VALUE ZEROS.
       01  Iterator                            PIC 999   VALUE ZEROS.
       01  Result                              PIC 9(6)  VALUE ZEROS.

       PROCEDURE DIVISION.

       ACCEPT Num1.
       MOVE Num1 TO Iterator
       ADD 1 TO Num1
       MOVE 1 TO Num2
       PERFORM Summing Iterator TIMES
       DISPLAY Result.
       STOP RUN.

       Summing.
           COMPUTE Result = Result + (Num1**2 - Num2**2)**.5
           ADD 1 TO Num2.

Next Sequence

Try it online!

COBOL was originally designed with ease-of-use as the goal. We've come a long way since then.

189. C# (Visual C# Compiler), 1182 bytes, A000105

Three parts - the function (824 bytes) + comparer class used in function (273 bytes) + imports (85 bytes)

n=>{var t=new Func<P,P>[]{p=>new P(p.Y,-p.X),p=>new P(-p.X,-p.Y),p=>new P(-p.Y,p.X),p=>new P(-p.X,p.Y),p=>new P(-p.Y,-p.X),p=>new P(p.X,-p.Y),p=>new P(p.Y,p.X)};Func<P[],P[][]>r=l=>new[]{l}.Concat(new int[7].Select((x,i)=>l.Select(p=>t[i](p)).ToArray())).ToArray();Func<int,P[][]>k=null;k=a=>a<2?new[]{new[]{new P(0,0)}}:k(a-1).SelectMany(l=>l.SelectMany(p=>new[]{new P(p.X-1,p.Y),new P(p.X+1,p.Y),new P(p.X,p.Y-1),new P(p.X,p.Y+1)}).Where(p=>!l.Contains(p)).Distinct().Select(p=>r(l.Concat(new[]{p}).ToArray()).Select(o=>o.Select(c=>new P(c.X-o.Select(q=>q.X).Min(),c.Y-o.Select(q=>q.Y).Min())).OrderBy(q=>q.X).ThenBy(q=>q.Y).ToArray()).Aggregate((m,o)=>(m==null||string.Concat(o.Select(x=>$"({x.X},{x.Y})")).CompareTo(string.Concat(m.Select(x=>$"({x.X},{x.Y})")))<0?o:m)))).Distinct(new C()).ToArray();return k(n).Length;}

class C:IEqualityComparer<P[]>{public bool Equals(P[] f,P[] s)=>f==s?1>0:(f==null|s==null)?1<0:f.OrderBy(p=>p.X).ThenBy(p=>p.Y).Zip(s.OrderBy(p=>p.X).ThenBy(p=>p.Y),(a,b)=>a==b).All(x=>x);public int GetHashCode(P[]l)=>l.Aggregate(0,(a,b)=>a.GetHashCode()^b.GetHashCode());}

using System.Collections.Generic;using P=System.Windows.Point;namespace System.Linq{}

Try it online!

Next sequence

I accidentaly deleted the extended version after I golfed it.... Also the code has 2 unneeded spaces added because A001180 was not fun.

188. Groovy, 105 bytes, A000321

def a
a = { n -> 
	if (n == 0G) { 1 }
	else if (n == 1G) { -1 }
	else {
		-a(n-1G)-2G*(n-1G)*a(n-2G)
	}
}

Try it online!

Next Sequence

187. SageMath, 321 bytes, A000177

import sage.combinat.partition
var('t', 's', 'isSquare')

def A000177(n):
  t = Partitions(n).list()
  s = 0
  for i in range(len(t)):
    if len(t[i])>6:
      continue
    isSquare = True
    for j in range(len(t[i])):
      if sqrt(t[i][j]) not in ZZ:
        isSquare = False
    if isSquare:
      s = s+1
  return s

Next Sequence

You can try it here.

186. axo, 177 bytes, A000017

10=01=02=23=24=45=86=47=82*8=43*9=68*25*=825**25*1+=89+8*26*=725**6*[26*1+=][2*55*2*8*+[27*=][2*778**+[35*=][2*26*1+4*1+9*4*+[44*=][2*55447****+[44*1+=][3*288**1+84**-29*= }={ \

Try it online!

I'm aware that hardcoding is apparently "lame" but this took me like half an hour so I'm not gonna trash it ;P

This essentially hardcodes all of the values and puts them into the memory, then uses the = function to read the specific memory address and output it.

Next Sequence

185. Octave, 17 bytes, A000142

@(n)factorial(n);

Try it online!

Next sequence

183. PostL, 61 bytes, A000134

INPUT PARSE 1 + C 3.1416 * 0.290498\ - FLR \ 1 \ 0 \ 2 - = +.

Try it online!

Next Sequence

_ is supposed to work in place of floor (or flr) but apparently it doesn't... hm

Walkthrough

INPUT PARSE 1 + C 3.1416 * 0.290498\ - FLR \ 1 \ 0 \ 2 - = +.  A000134
INPUT                                                          Take a line of input
      PARSE                                                    Parse to a double
            1                                                  Push 1
              +                                                Add top two elements
                C                                              Copy the zero-indexed number
                  3.1416                                       ~pi
                         *                                     Multiply top two elements
                           0.290498                            Thanks to Husnain Raza for this magic number
                                   \                           Swap the top two elements
                                     -                         Subtract the second from the top
                                       FLR                     Floor
                                           \                   Swap top two
                                             1                 Push 1
                                               \               Swap top two
                                                 0             Push 0
                                                   \           Swap top two
                                                     2         Push 2
                                                       -       Subtract the second from the top
                                                         =     Switch: 1 if x == 2 else 0
                                                           +.  Add top two and print

178. GAP, 933 bytes, A000214

Luckily GAP wasn't taken for No. 167 (A000638)!

AG := function( n )
  local b, sw, sh, xr, tr, gens;
  b := BasisVectors(Basis(FullRowSpace(GF(2),n+1)));
  gens := [];
  if n>1 then
    sw := ShallowCopy(b);
    sw{[2,3]} := sw{[3,2]};
    sh := ShallowCopy(b);
    sh{[2..n+1]} := sh{Concatenation([n+1],[2..n])};
    xr := ShallowCopy(b);
    xr[2] := xr[2]+xr[3];
    gens := [ sw, sh, xr ];
  fi;
  tr := ShallowCopy(b);
  tr[2] := tr[1]+tr[2];
  Add(gens, tr);
  return Group(List(gens,TransposedMat));
end;

Fix := function( g )
  local o, h, s, i, k;
  o := One(g);
  s := 2^(Size(g)-1);
  i := 1;
  h := g;
  while not IsOne(h) do
    k := NullspaceMat( h-o );
    if ForAny( k, v -> IsOne(v[1]) ) then
      s := s + 2^(Size(k)-1);
    fi;
    i := i+1;
    h := h*g;
  od;
  return 2^(s/i);
end;

f := function( n )
  local grp;
  grp := AG(n+1); # zero based
  return Sum( ConjugacyClasses(grp),
              cc -> Size(cc)*Fix(Representative(cc)) ) / Order(grp);
end;

This is using somewhat advanced group theory (Burnside's lemma, twice), but no deep knowledge of the affine group. Still it is good enough to compute the 9th and 10th value (and more), which are:

3743090921588631997590183810292071781042846067942809230428008257901850006463197026597863697259931801933484260185559925420090026
479084991876032922658580043148767307553909132799686744495116429395794360341231625183693228836152593000430870733973647565874325953529940377811130038575926765372370447759627109606902989971984053705702177123141099357638755205930373003087364483930095902877678789627725054625735636

Next sequence

How does it work?

There are 2^(2^n) Boolean functions of n variables. The affine group AG(n,2) acts on these functions by transforming the input. An affine transformation can permute the input, xor one input to another, and negate an input. (xor is addition in the field with two elements, negation is addition of one.)

If a Boolean functions can be transformed in this way into an other, we consider them equivalent. The equivalence classes are called orbits. We want to know how many orbits there are.

Burnside's lemma tells us that the number of orbits of an action of a group G on a set X equals the sum of the number of elements of X that are fixed by g (the sum is over each element g of G) divided by the order (size) of the group G.

Since the affine group is big for moderate sizes of n, we want to avoid summing over all its elements. Conjugated elements fix the same number of elements of X, so we can sum instead over conjugacy classes and multiply with the size of the conjugacy class. There are not that much conjugacy classes, and GAP can compute them in reasonable time. (I wasn't sure about this when I started programming.) This is what the main function f does, using helper functions AG to create the affine group and Fix to determine the number of boolean functions that are fixed by an affine transformation.

An affine transformation can be given by an invertible matrix A and an translation vector b, it maps x to Ax+b. This can be brought into the realm of linear algebra by embedding it into n+1 dimensional space. The affine transformation is represented by [[1, 0], [b, A]] (GAP wouldn't accept this). To see where the n dimensional x is mapped to, add a first component of 1, multiply with the matrix, and drop the first component of the result (which will be 1). You can think of adding an extra input that is always 1 and can not be changed by the transformation, but can be added (xor-ed) to other inputs. The AG function creates the affine group as matrix group using this representation.

We create the affine group using four generators, the first three are only meaningful for n>1. The first swaps the first two inputs, the second cyclically shifts the inputs. (For n=2 they are the same, but that is no problem.) Together they generate all permutations of inputs. The third xors the second input to the first. By conjugation with a permutation, this gives all needed xor operations. Together, these three matrices generate the general (or special, that's the same in this case) linear group GL(n,2). The last generator negates the first input. Again, conjugation with a permutation gives the other negations, so all matrices together generate the affine group AG(n,2). You may have noted that my thinking, explaining and constructing has been in terms of right multiplying a column vector to a matrix. GAP however uses row vectors and left multiplication. Since I will use GAP's linear algebra functionality later, I compensate by transposing the generating matrices before construction the group.

Now to the function Fix. We are given an affine transformation g and want to calculate the number of Boolean functions that it fixes. A function is fixed by g if it gives the same result to some input and to this input transformed by g (or g^2 etc). If an input can not be transformed into an other by a power of g, then the function may give different results for them. So the result is 2 to the number of classes of inputs that may get different results. We can get this number by another application of Burnside's lemma! This time the group is the cyclic group generated by g, and it is acting on the set of inputs of size 2^n. We really sum over all elements of the group now. The identity fixes all inputs, so we start the sum s with this number. Now assume we have a power h of g and want to know how many inputs it fixes. That means we want to know how many n+1 dimensional vectors with first component 1 are fixed by the matrix h, or how many are mapped to zero by h-1. So we use NullspaceMat to compute a basis of the kernel of h-1. If that contains no element with a 1 at the first component, then there are no solutions, otherwise there are half as many as the kernel size. In the end i contains the number of elements of the cyclic group, by which we divide the sum s as Burnside's lemma tells us.

The last time I wrote similar code I used it to compute some numbers which I could use to find the series on OEIS and then find a better way to compute them there...

I guess that the algorithm could be improved a lot without very complicated math. For example, I think it should be useful that the affine group is a semidirect product, but we give it to GAP as if it were any random matrix group.

Now I hope this was useful or interesting for someone. I never know how much detail I should give in an explanation here.

182. Common Lisp, 134 bytes, A000276

(defun fact(n) (if (< n 2) 1 (* n (fact (1- n)))))
(defun a(n) (* (fact (+ n 3)) (1- (loop for k from 1 to (+ n 2) summing (/ 1 k)))))

Trival use of the formula specified by Detlefs on the OEIS page

Try it online!

Next sequence

181. C (clang), 276 bytes, A000063

long Factorial(n){return n<2?1:n*Factorial(n-1);}
Choose(n,k){return Factorial(n)/Factorial(k)/Factorial(n-k);}
Catalan(double n){return n-(int)n?0:(int)(1/(n+1.)*Choose(2*n,n));}
A000063(n){return Catalan(-~-~-~-~-~n/2-1)-Catalan(-~-~-~-~-~n/4.-1)-Catalan(-~-~-~-~-~n/6.-1);}

180. C (tcc), 63 bytes, A000062

#include <math.h>
int a(int n){
  return (n + 1) / (M_E - 2);
}

Try it online!

Next sequence!

Now since there is a lot of C versions, C must get the same treatment as Python.

179. C (clang), 62 bytes, A000933

f(n){double c=(n>2)*~-~-n*~-~-~-n/3./4;return c+(c-(int)c>0);}

156. C# (Mono), 2466 bytes, A000083

Note: the score is 2439 bytes for the code and 27 for the compiler flag -reference:System.Numerics.

using Num = System.Numerics.BigInteger;
namespace PPCG
{
    class A000083
    {
        static void Main(string[] a)
        {
            int N = int.Parse(a[0]) + 1;

            var phi = new int[N + 1];
            for (int i = 1; i <= N; i++)
                phi[i] = 1;
            for (int p = 2; p <= N; p++)
            {
                if (phi[p] > 1) continue;
                for (int i = p; i <= N; i += p)
                    phi[i] *= p - 1;
                int pa = p * p;
                while (pa <= N)
                {
                    for (int i = pa; i <= N; i += pa)
                        phi[i] *= p;
                    pa *= p;
                }
            }

            var aik = new Num[N + 1, N + 1];
            var a035350 = new Num[N + 1];
            var a035349 = new Num[N + 1];
            aik[0, 0] = aik[1, 1] = a035350[0] = a035350[1] = a035349[0] = a035349[1] = 1;
            for (int n = 2; n <= N; n++)
            {
                // A000237 = EULER(A035350)
                Num nbn = 0;
                for (int k = 1; k < n; k++)
                    for (int d = 1; d <= k; d++)
                        if (k % d == 0) nbn += d * a035350[d] * aik[1, n - k];
                aik[1, n] = nbn / (n - 1);

                // Powers of A000237 are used a lot
                for (int k = 2; k <= N; k++)
                    for (int i = 0; i <= n; i++)
                        aik[k, n] += aik[k - 1, i] * aik[1, n - i];

                // A035350 = BIK(A000237)
                Num bn = 0;
                for (int k = 1; k <= n; k++)
                {
                    bn += aik[k, n];
                    if (k % 2 == 1)
                        for (int i = n & 1; i <= n; i += 2)
                            bn += aik[1, i] * aik[k / 2, (n - i) / 2];
                    else if (n % 2 == 0)
                        bn += aik[k / 2, n / 2];
                }
                a035350[n] = bn / 2;

                // A035349 = DIK(A000237)
                Num dn = 0;
                for (int k = 1; k <= n; k++)
                {
                    // DIK_k is Polyà enumeration with the cyclic group D_k
                    // The cycle index for D_k has two parts: C_k and what Bower calls CPAL_k
                    // C_k
                    Num cikk = 0;
                    for (int d = 1; d <= k; d++)
                        if (k % d == 0 && n % d == 0)
                            cikk += phi[d] * aik[k / d, n / d];
                    dn += cikk / k;

                    // CPAL_k
                    if (k % 2 == 1)
                        for (int i = 0; i <= n; i += 2)
                            dn += aik[1, n - i] * aik[k / 2, i / 2];
                    else
                    {
                        Num cpalk = 0;
                        for (int i = 0; i <= n; i += 2)
                            cpalk += aik[2, n - i] * aik[k / 2 - 1, i / 2];
                        if (n % 2 == 0)
                            cpalk += aik[k / 2, n / 2];
                        dn += cpalk / 2;
                    }
                }
                a035349[n] = dn / 2;
            }

            // A000083 = A000237 + A035350 - A000237 * A035349
            var a000083 = new Num[N + 1];
            for (int i = 0; i <= N; i++)
            {
                a000083[i] = aik[1, i] + a035349[i];
                for (int j = 0; j <= i; j++) a000083[i] -= aik[1, j] * a035350[i - j];
            }

            System.Console.WriteLine(a000083[N - 1]);
        }
    }
}

Online demo. This is a full program which takes input from the command line.

Next sequence

Dissection

I follow Bowen's comment in OEIS that the generating function A000083(x) = A000237(x) + A035349(x) - A000237(x) * A035350(x) where the component generating functions are related by transforms as

I use the definitions of BIK and DIK from https://oeis.org/transforms2.html but the formulae seem to have a number of typos. I corrected LPAL without much difficulty, and independently derived a formula for DIK based on applying Pólya enumeration to the cycle index of the dihedral group. Between #121 and #156 I'm learning a lot about Pólya enumeration. I have submitted some errata, which may prove useful to other people if these transforms come up again in the chain.

174. C++ (gcc), 54 bytes, A000257

int f(int n){return n?~-~-~-~-(n<<3)*f(~-n)/-~-~n:01;}

177. Lua, 214 bytes, A000184

function v(n)if n<1then return 1 end return v(~~~-n)*n end
function V(n)if n<1then return 1 end return V(~-~-n)*n end
function F(n)return math.floor(1/12*(2^(-~-~n+1)*V(-~(-~-~n<<1))/v(-~-~n-1)-3*4^-~-~n*-~-~n))end

176. JavaScript (ES6), 184 bytes, A000122

function A000122(n) {
 if (n === 0) { return 1; }
 squares = [];
 for (i = 0; i <= 32; i++) {
  squares.push(i*i);
 }
 if (~squares.indexOf(n)) {
  return 2;
 } else {
  return 0;
 }
}

Try it online!

Next Sequence

175. PHP, 122 bytes, A000054

<?php
$n=file_get_contents('php://stdin');$s=0;for($i=0;$i<=$n;$i++){$s+=ord("DJIKHHIMIEJGGFIJJJHEGFIJG"[$i])-64;}echo $s;

Try it online!

Next sequence!

Uses delta encoding with the deltas represented by uppercase ASCII characters. The next sequence looks intimidating but it's just 1 at 0, 2 if sqrt(n) is an integer and 0 otherwise.

173. Python 2 (IronPython), 257 bytes, A000055

c={0:0,1:1}
def b(n):
 if n not in c:c[n]=sum([sum([d*b(d)for d in range(1,j+1)if j%d==0])*b(n-j)for j in range(1,n)])//(n-1)
 return c[n]
def a(n):return 1if n==0 else b(n)-(sum([b(k)*b(n-k)for k in range(n)])-(b(n//2)if n%2==0 else 0))//2
print a(input())

Try it online!

Next sequence!

2 versions of Python on the wall, 2 versions of Python. Take one down and pass it around, 1 version of Python on the wall.

Caches the results of b because it seemed like it would take forever to compute for big n without it. Didn't test whether it does anything useful, but it probably does.

172. Python 1, 55 bytes, A000541

S=0
for s in range(-~input()):S=S+s*s*s*s*s*s*s
print S

Try it online!

Next Sequence: A000055

171. TrumpScript, 541 bytes, A000204

Putin hears all your life
Putin is safe because its Putin
Trump is, 1000001 minus 1000000; great
Our beautiful America is, 1000003 minus 1000000; the greatest
Of course everything is, Trump plus Trump;
Every million is for Trump;
If you want, Putin is Trump?;:
Say Putin!
Otherwise: if for you, Putin is Everything?;:
Say America!
Otherwise:
Money is Everything
As long as, our Money less than Putin;:
Russia is America
America is, Trump plus America;
Trump is Russia
Money is, Money plus Million;!
Say America with force!!
America is great.

Try it online!

Next sequence

Pseudocode for explanation:

var Putin = int(input())
var Trump = 1
var America = 3
var Everything = Trump + Trump
var Million = Trump
if(Putin == Trump)
    print(Putin)
else if(Putin == Everything)
    print(America)
else
    var Money = Everything
    while(Money < Putin)
        var Russia = America
        America = Trump + America
        Trump = Russia
        Money = Money + Million
    print(America)
America is great.

170. Python 3 (PyPy), 204 bytes, A000084

n=int(input())+1
a=[0,1,1,2]
p=[0,1,3,7]
for m in range(4,n+1):s=sum([d*a[d]for d in range(1,m)if m%d==0]);u=p[m-1]+2*sum([p[k]*a[m-k]for k in range(1,m-1)])+s;a+=[u//m];p+=[s+u]
print(2*a[n]if n>1else 1)

Try it online!

Next sequence!

4 Pythons down, 2 to go. Wait, there's Python 0 but no one used it in the first 150 answers. 3 to go.

Ported the second Maple program for A000669. Next sequence is Lucas numbers - as easy as Fibonacci, but nicer.

169. Chez Scheme, 84 bytes, A000261

(define (a n)
(if (< n 1)
 n 
 (+ (* (+ n 1) (a (- n 1))) (* (- n 2) (a (- n 2))))))

Try it online!

Next sequence

168. Python 2 (PyPy), 261 bytes, A000101

import sympy

def A000101(n):
  i = 0
  p = 2
  max_difference = 0
  while i <= n:
    next_p = sympy.nextprime(p)
    if next_p-p > max_difference:
      max_difference = next_p - p
      i = i + 1
    p = next_p    
  return p

print A000101(int(raw_input()))

Next Sequence

Try it online!

Others want to starve the challenge of the use of Python, so I'll help.

167. Magma, 101 bytes, A000638

a000638:=function(n);if n eq 0 then return 1;else return#SubgroupClasses(Sym(n));end if;end function;

Next sequence

You're probably thinking "This is taken from the OEIS site!", but hold on. While checking Magma documentation, I found something interesting here. One of OEIS descriptions of this sequence is number of conjugacy classes of subgroups of symmetric group S_n, and the documentation speaks of a build-in! And it's a different one than the one used on OEIS SubgroupLattice(), this one is SubgroupClasses(). So it happens that both functions create the same amount of subgroups (possibly how the math of this works - I'm not sure), but SubgroupClasses() is actually THE correct way. Thus I felt that this answer is eligible.

You can try it here

Code usage:

Just paste the function and then call it by a000638(5); or any other number instead of 5 (note, anything higher than 11 will time out). You can also use this to output 11 first integers in the sequence:

for i := 0 to 10 by 1 do a000638(i); end for;

Code explanation:

a000638 := function(n);           // Create a function taking one argument
    if n eq 0 then                // If argument is 0
        return 1;                 //     Then return 1
    else                          // Otherwise
        return #                  //     Count and return the number of
               SubgroupClasses(   //         Conjugacy classes of subgroups of
                   Sym(n)         //             Symmetric group of order n
               );
    end if;
end function;

166. Scratch 2, 638 bytes, A000114

code as image

Or, when written as text in the ScratchBlocks2 format:

when green flag clicked
ask [] and wait
set [a v] to ((answer) + (2))
if <(a) = [2]> then 
  say [3]
else 
  set [b v] to (((a) * (a)) / (2))
  set [d v] to [2]
  repeat until <(d) = (a)> 
    if <((a) mod (d)) = [0]> then 
      set [c v] to [2]
      set [prime v] to [1]
      repeat until <<(prime) = [0]> or <(c) > ([sqrt v] of (d))>> 
        if <((d) mod (c)) = [0]> then 
          set [prime v] to [0]
        end
        set [c v] to ((c) + (1))
      end
      if <(prime) = [1]> then 
        set [b v] to ((b) * ((1) - ((1) / ((d) * (d)))))
      end
    end
    set [d v] to ((d) + (1))
  end
  say ((b) - ((b) mod (1)))
end

Next sequence

165. Forth, 114 bytes, A001000

: C 4 * 5 - s>f fsqrt f>s ;
: A 1+ dup 2 < IF 1+ ELSE dup dup * swap dup C dup dup * 4 / 1+ -rot * -1 * + + THEN ;

Try it online

Next Sequence

This could have been golfed to 106 by moving C into the function A, but that OEIS sequence looked harder for the next person. Or it grew faster, anyway.

Explanation:

In the previous answer, people were unsure of the algorithm for this one. It looked difficult, but the OEIS page stated: "This is the same sequence (apart from the initial term) as A071111." So, I used that sequence, then used an IF THEN ELSE to output 2 if the input is 1.

I added one at the beginning of the function because the sequence has an offset of one. This makes it zero-indexed.

The algorithm:

a(n) = n^2 - n*c(n) + floor(c(n)^2/4) + 1, where c(n) = floor(sqrt(4n-5))

The comments on the page for A071111 also state the results for a(100) and a(1000), and mine are the same.

164. cQuents, 1000 bytes, A000227

$0:R_e^$)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Try it online!

Next Sequence

Explanation

$0           0-indexed
  :          Mode: Sequence - output whole sequence, or nth item for input n
   R    )    Round - closing paren added if absent
    _e^$     e to the power of the current index
             Spaces for padding

163. R, 227 bytes, A000448

A000448 <- function(n){
  if(n == 0)
    return(0)
  k <- 1
  l <- (0:k)^2
  g <- table(combn(l,2,sum))
  while(max(g) < n+1){
    k <- k+1
    l <- c(l,k^2)
    g <- table(combn(l,2,sum))
  }
  min(as.numeric(names(g[g>n])))
}

Try it online!

Next Sequence

Brute force approach! Takes sums of unordered pairs of squares, combn(l,2,sum), tabulates them with table to get counts, and then iterates until it finds one that can be written as the sum of squares in n+1 ways (so it's zero-indexed). Then it extracts the names, converts them to numeric, and selects the min. This will lose precision after about n = 64, at which point (most) R implementations would convert the sums to doubles. That could be saved by using a bigz implementation but that's not what we have to do here.

It also times out on TIO for n=10 because this is slow as all get-out.

162. Julia 0.6, 448 bytes, A000208

This is the third time that I've implemented A000013 in this challenge.

function EulerPhi(n)
  x = 0
  for i = 1:n
    if gcd(i,n) == 1
      x = x + 1
    end
  end
  return x
end

function A000013(n)
  if n <= 1
    return 1
  end
  x = 0
  for d = 1:n
    if n/d == n÷d
      x = x + (EulerPhi(2*d) * 2^(n/d))/(2*n)
    end
  end
  return x
end

function A000208(n)
  x = 0
  if n <= 1
    x = 1
  elseif n/2 == n÷2
    x = (A000013(2*n) + A000013(n)) / 2
  else
    x = A000013(2*n) / 2
  end
  return Int(x)
end  

Try it online!

Next Sequence

161. Ruby, 208 bytes, A000315

size = gets.chomp.to_i
puts (1..size).to_a.permutation.to_a.permutation(size).to_a.select{|x| x.transpose.all? {|y| y.uniq.size == y.size} and x[0].sort == x[0] and x.transpose[0].sort == x.transpose[0]}.size

Note that this is an extremely slow implementation. I might make a faster one eventually and post it as a side note (so as to not change the bytecount)

Also, this is my first Ruby program :D

Try it on Repl.it!

Next Sequence

160. Bash, 315 bytes, A000778

#!/bin/bash

array=()
array[0]=1
i=1
read n

while [ $i -le $(expr 2 * $n + 2) ]
do
    let array[$i]=array[$(expr $i - 1)]*$i
    let i=i+1
done

echo $(expr ${array[$(expr 2 * $n)]} / ${array[$n]} / ${array[$(expr $n + 1)]} + ${array[$(expr 2 * $n + 2)]} / ${array[$(expr $n + 1)]} / ${array[$(expr $n + 2)]} - 1)

Try it online!

A000315

159. Java (OpenJDK 8), 778 bytes, A000048

import java.util.Scanner;
import java.math.BigInteger;

public class Main {
 static boolean isPrime(int n){
  if(n % 2 == 0) return n == 2;
  for(int d = 3;d*d <= n;d += 2){
   if(n % d == 0) return false;
  }

  return true;
 }

 static int mu(int n){
  int r = 1;
  for(int p = 2;p <= n;p++){
   if(!isPrime(p) || n % p != 0) continue;
   if(n % (p*p) == 0) return 0;
   r = -r;
  }

  return r;
 }

 static BigInteger a(int n){
  if(n == 0) return BigInteger.ONE;
  BigInteger s = BigInteger.ZERO;
  for(int d = 1;d <= n;d += 2){
   if(n % d == 0) s = s.add(BigInteger.valueOf(mu(d)).shiftLeft(n / d));
  }

  return s.divide(BigInteger.valueOf(2 * n));
 }

 public static void main(String args[]){
  int n = new Scanner(System.in).nextInt();
  System.out.println(a(n));
 }
}

Try it online!

Next sequence!

158. Jelly, 48 bytes, A000376

ḣ1‘Ṭœṗ
ÇḢU$;$F
ÇÐĿ
ṫ0ḢṢ⁼$
‘RŒ!Q3Ŀ€ÇÐfL€Ṁ’¹¹¹¹¹¹¹

Try it online!

Explanation

ḣ1‘Ṭœṗ                  Helper Link 1; splits the list into two sublists, the first of which is reversed
ḣ1                      First 1 element(s) without modifying the original list
  ‘                     Increment
   Ṭ                    Generate a boolean list with 1s at the indices in (left)
    œṗ                  Partition, keeping borders
ÇḢU$;$F                 Helper Link 2; applies 1 iteration of the TopSwop operation
Ç                       Partition with length of the first element
 ḢU$;$                  Reverse the first list and concatenate it with the second list
 ḢU$                    Reverse the first list
 Ḣ                      Head; modifies the list
  U                     Reversed
    ;                   Concatenated with (the second list, implicit)
      F                 Flatten
ÇÐĿ                     Helper Link 3; completes TopSwops for a list
 ÐĿ                     While the results are unique (collects intermediate results)
Ç                       TopSwop once
ṫ0ḢṢ⁼$                  Helper Link 4; returns whether or not a list is sorted
ṫ0                      Last 0 sublists (gives the last one without modifying the original list)
  Ḣ                     Head; this unwraps the length 1 list of a single list
   Ṣ⁼$                  Is it sorted?
   Ṣ                    The list sorted
    ⁼                   equals (the original list, implicit) (non-vectorizing)
‘RŒ!Q3Ŀ€ÇÐfL€Ṁ’¹¹¹¹¹¹¹  Main Link
‘                       Increment (for 0-indexing)
 R                      Range
  Œ!                    All permutations (with duplicates)
    Q                   Deduplicate (technically unnecessary)
       €                For each sublist
     3Ŀ                 Apply Helper Link 3; completes TopSwops
         Ðf             Keep sublists where
        Ç               The end result is sorted
            €           For each element
           L            Yield its length
             Ṁ          Get maximum length
              ’         Decrement because the first "iteration" is the beginning list
               ¹¹¹¹¹¹¹  Identity function chained 7 times; has no effect in this situation

Next Sequence - More necklaces yay

149. dash, 1993 bytes, A000173

Important: this is a precaution in case the INTERCAL answer for #149 is disqualified, to avoid #148 ending the chain due to the week having expired. It is deliberately the same length in order to preserve following answers.

succ () {
    # The successor is the sum of strictly smaller unitary divisors, where a
    # unitary divisor is a product of some subset of the maximal prime power divisors.
    # In other words, if we factor n as
    #   \prod_i p_i^{a_i}
    # then the successor should be
    #   \prod_i (p_i^{a_i} + 1) - n
    local n=$1
    local m=1
    factor $n | sed "s% %\n%g" | tail -n +2 | uniq -c |
        # Workaround for buggy read on my computer
        sed "s%^ *%%;s% %\n%" |
        while read x
        do
            read y
            z=1
            for i in $( seq $x )
            do
                z=$(( z * y ))
            done
            m=$(( m * (z + 1) ))
            # echo here and take tail because scope problems mean that m loses its
            # value outside this pipeline
            echo $(( m - n ))
        done
}

inseq () {
    local n=$1
    # We detect rhos using the little-step big-step method. If at any point we hit a
    # value less than n, clearly n isn't the smallest element of a cycle
    local k=$( succ $n | tail -1 )
    # If we loop already, it's unitary-perfect
    if test $k -le $n ; then return 1 ; fi

    local m=$( succ $k | tail -1 )
    # Loop already => it's unitary-amicable
    if test $m -le $n ; then return 1 ; fi

    while true
    do
        # Advance k once
        k=$( succ $k | tail -1 )
        # Advance m twice
        m=$( succ $m | tail -1 )
        if test $m -eq $n ; then return 0 ; fi
        if test $m -lt $n -o $m -eq $k ; then return 1 ; fi
        m=$( succ $m | tail -1 )
        if test $m -eq $n ; then return 0 ; fi
        if test $m -lt $n -o $m -eq $k ; then return 1 ; fi
    done
}

idx=$1
# Naive approach: test all values from 2 to see whether they're in the sequence
# until we've found enough that are
j=2
while true
do
    if inseq $j
    then
        if test $idx -eq 0
        then
            echo $j
            return 0
        fi
        idx=$(( idx - 1 ))
    fi

    j=$(( j + 1 ))
done

Online demo

Next sequence

155. Python 3, 83 bytes, A000262

a = lambda n: (2 * n - 1) * a(n - 1) - (n - 1) * (n - 2) * a(n - 2) if n > 1 else 1

Try it online!

Next sequence.

I shall starve this challenge of Python for the future. Fight me. ಠ_ಠ

...Also good luck with the next sequence. :P

154. Verilog, 262 bytes, A001344

module OEIS1344 (input c, input [99:0] n, output reg [99:0] r=0, output reg v=1'b1);
reg [99:0] i,f;
always @ (posedge c) if(v)begin f=n-((n>0)?1:0);v=(f==0);i=f-1;r=(n*(n+3))+((n==0)?2:1);end else begin v=(i==0)||(i==-1);f=v?f:f*i;i=i-1;r=v?r*f:r;end 
endmodule

Next sequence!

The Verilog module above calculates OEIS A001344.

The code below is the same code but prettified, and a testbench module added to allow you to run the code in a Verilog simulator such as modelsim.

I have verified inputs up to the 22nd element in the sequence, beyond which OEIS runs out of examples, and shortly afterwards the numbers start overflowing 100bit arithmetic. I believe that is allowed as per the rules about assuming input and output numbers will never overflow the language. Originally I had used 32bit arithmetic which caused overflow at 13, but without changing the byte count (just 3 numbers from 31 to 99) we can get up to 22-ish.

When simulating, the input number is clocked in on the rising edge. v may go low if it is going to take more than one clock cycle to calculate. Once v is high after the clock edge that loaded the number, the output r can be considered a valid number of the OEIS A001344 sequence.

The code is actually making use of the related OEIS sequence, A028387 which calculates n + (n+1)^2. By multiplying the n+1'th element of that sequence by n! we arrive at the A001344 sequence. All that is required is a little fiddling around with the value of n to make it 0-indexed as per the requirements and we have our result.

To do this in Verilog is a little bit of a pain as it requires a factorial. The simplest approach is to use an iterative approach over n clock cycles to calculate the factorial and output the final result.

I should probably point out that both the OEIS1344 module and its testbench are very naïve approaches to get the job done. But since joining PPCG I've wanted to be able to use Verilog in an answer, and I found a way to shoehorn it into this one.


The following is an example output from ModelSim:

Testbench Output Example

The following is the testbench code:

module OEIS1344_test;

reg c = 0;
always begin
    #10 c = !c;
end

reg  [99:0] n;
wire [99:0] r;
wire v;

OEIS1344 dut (
    .c(c),
    .n(n),
    .r(r),
    .v(v)
);

reg  [99:0] i;
initial begin
    for (i = 0; i < 23; i=i+1) begin
        n = i;
        @(posedge c);
        while (!v) @(posedge c);
    end
end

endmodule

module OEIS1344 (
    input c,
    input [99:0] n,
    output reg [99:0] r = 0,
    output reg v = 1'b1
);

reg [99:0] i,f;
always @ (posedge c) begin
    if (v) begin
        f = n - ((n > 0) ? 1 : 0);
        v = (f == 0);
        i = f - 1;
        r = (n * (n + 3)) + ((n == 0) ? 2 : 1);
    end else begin
        v = (i == 0) || (i == -1);
        f = v ? f : f * i;
        i = i - 1;
        r = v ? r * f : r;
    end
end
endmodule

152. Mathics, 136 bytes, A000031

EulerPhi[x_] := Sum[If[CoprimeQ[i,x], 1, 0], {i, 1, x}]
OEIS[x_] := Sum[If[IntegerQ[x/d], (EulerPhi[d]*2^(x/d)), 0], {d,1,x}]/x
OEIS[#]&

Next Sequence.

Try it online!

This is just my previous Mathics answer, modified for the new sequence.

151. Python 2, 31 bytes, A000125

lambda n:(n**3 + 5 * n + 6) / 6

Try it online!

Next sequence.

Alright, so the next one looks like an absolute doozy when you look at the title:

Number of n-bead necklaces with 2 colors when turning over is not allowed; also number of output sequences from a simple n-stage cycling shift register; also number of binary irreducible polynomials whose degree divides n.

Yeah... I dunno how people comprehend this stuff... But the formula doesn't look too bad.

a(n) = (1/n)*Sum_{ d divides n } phi(d)*2^(n/d), where phi is A000010.

Here's a Python 3 implementation:

import math

phi = lambda n: len([i for i in range(1, n + 1) if math.gcd(n, i) == 1])
A000031 = lambda n: n and sum(phi(d) * 2 ** (n / d) for d in range(1, n + 1) if n % d == 0) / n or 1

Try it online!

150. Julia 0.6, 125 bytes, A001993

function A001993(n)
 m=zeros(15,15)
 for i=1:14
 m[i,i+1]=1
 end
 m[:,1]=[1;2;0;-2;-4;1;3;3;1;-4;-2;0;2;1;-1]
 (m^n)[1,1]
end

Next sequence

Try it online!

The next one is easy, and all languages are back on the table, so somebody may have to re-work the stack snippet to allow for multiple uses (I don't know enough javascript to tell if that's already there or not).

Implements the matrix product formula given in the OEIS page. It was pretty fun learning a bit of Julia; it's quite similar to Matlab.

148. Python 2 (IronPython), 173 bytes, A000695

def to_b_4(k):
 r=""
 while k>0:
  r=`k%4`+r
  k //=4
 return r
n=input()
i=j=b=0
while i<=n:
 b=set(to_b_4(j))
 if not("2"in b or"3"in b or"4"in b):
  i+=1
 j+=1
print(j-1)

Try it online!

Next Sequence

147. Elixir, 695 bytes, A000121

defmodule A do
 def p(n) do p(n,n,[]) end
 def l(t,m,s) when m > 1 do p(t,m-1,s) end
 def l(_,_,_) do [] end
 def r(t,m,s) when m <= t do p(t-m,m,[m]++s) end
 def r(_,_,_) do [] end
 def p(0,_,s) do [s] end
 def p(t,m,s) do l(t,m,s) ++ r(t,m,s) end

 def f(n) do f(n,[1,1]) end
 def f(n,l) do
  if Enum.at(l, -1) >= n do l else
   f(n, l ++ [Enum.at(l, -1) + Enum.at(l, -2)])
  end
 end

 def n(l) do
  Enum.sum Enum.map(l,fn n -> if n == 1 do 1 else 0 end end)
 end

 def a(0) do 1 end
 def a(n) do
  fb = f(n)
  score = fn l -> if length(l -- fb) == 0 do if n(l) == 1 do 2 else 1 end else 0 end end
  Enum.sum Enum.map(p(n), score)
 end
end

{n,_} = Integer.parse IO.gets("")
IO.inspect A.a(n)

Try it online!

Next sequence!

146. PicoLisp, 121 bytes, A000271

(de a (n) (cond ((= n 0) 1) ((< n 3) 0) ((< n 4) 1) (T (+ (* (- n 1) (a (- n 2))) (* (- n 1) (a (- n 1))) (a (- n 3))))))

Next Sequence

Try it online!

I also implemented A000179 in PicoLisp to try and do sums on it, but this was faster.

I'm running out of Lisp variants to work on!

145. Phoenix, 271 bytes, A000068

#https://stackoverflow.com/a/39743570/7605753
function is_prime(n){for(var $i=n>>1;$i&&n%$i--;);return!$i&&n>1;}
$n = readline();
$j = 0;
$k = 1;
while (1) {
 $m = pow($k, 4) + 1;
 if (is_prime($m)) {
  if ($j == $n) {
   echo $k;
   exit();
  }
  $j += 1;
 }
 $k += 1;
}

Try it online!

Next Sequence

142. Erlang (escript), 782 bytes, A000039


p(N) -> lists:usort([lists:sort(E)||E<-f(p(N,N))] ++ [[N]]).
p(1,_) -> [[1]];
p(N,M) -> 
    Extra = [ [lists:sort(Y++[X])||Y<-p(N-X,M)] || X<-lists:seq(1,N-1)],
    if N == M -> Extra; true -> [[N]|Extra] end.

f([])  -> [];
f([H|T]=L) when is_integer(H),is_list(T) ->
    case is_flat(T) of
        true  -> [lists:flatten(L)];
        false -> f([e(H,E) || E <- T]) 
    end;
f([H|T]) -> f(H) ++ f(T);
f(H)    -> [H].

e(A,B) when is_list(B) -> [A|B];
e(_,B) -> B.

is_flat(L) when is_list(L) -> length([E||E<-L, is_list(E)]) < 2;
is_flat(_) -> true.

rank(P) -> lists:max(P) - length(P).

score(P) -> (1 - abs(rank(P) rem 2)) * 2 - 1.

a(0) -> 1;
a(N) -> lists:sum(lists:map(fun(P) -> score(P) end, p(N))).

main([])-> {ok, [N]} = io:fread("", "~d"),
io:fwrite("~p", [a(2*N)]).

Try it online!

Next sequence!

Partition function from here.

140. MATLAB, 918 bytes, A000052

function q = intToNum(N)
function o = g(N)
n=[0,1,2,3,4,5,6,7,8,9,10+(0:9),(2:9)*10];
e={'zero';'one';'two';'three';'four';'five';'six';'seven';'eight';'nine';'ten';'eleven';'twelve';'thirteen';'fourteen';'fifteen';'sixteen';'seventeen';'eighteen';'nineteen';'twenty';'thirty';'forty';'fifty';'sixty';'seventy';'eighty';'ninety'};
    if N<=20
      o=e{N+1};
    elseif N<100
      if mod(N,10)==0
        s='';
      else
        s=g(mod(N,10));
      end
      o=strcat(e{(N-mod(N,10))==n},s);
    elseif N<1000
      if mod(N,100)==0
        s='';
      else
        s=g(mod(N,100));
      end
      o=strcat(g(floor(N/100)),'hundred',s);
    elseif N>=1000
      o=strcat(g(floor(N/1000)),'thousand',g(mod(N,1000)));
end
end
[~,I]=sort(arrayfun(@g,0:9,'un', 0));
R=0:9;
R=R(I);
S=10:99;
[~,I]=sort(arrayfun(@g,S,'un',0));
R=[R,S(I)];
S=100:999;
[~,I]=sort(arrayfun(@g,S,'un',0));
R=[R,S(I)];
q=R(N);
end

Try it online!

next sequence

To run properly in matlab, this needs to be saved as intToNum.m which is +10 bytes. However, this should also work in Octave with minor modifications (as in the TIO link)

141. MOO, 39 bytes, A000918

return $math_utils:pow(2,args[1])-1-1-0

Next sequence

139. Perl 6, 52 bytes, A000689

my $n=get();
$n= 2**$n;
print substr($n,$n.chars-1);

Try it online!

Next Sequence

138. Chapel, 689 bytes, A000701

proc sigma(n: int): int { // A000203
	var sum: int = 0;
	for d in 1..n {
		if n % d == 0 {
			sum += d;
		}
	}

	return sum;
}

proc sumodd(n: int): int { // A000593
	var sum: int = 0;
	for d in 1..n {
		if (n % d == 0) & (d % 2 == 1) {
			sum += d;
		}
	}

	return sum;
}

proc part(n: int): int { // A000041
	if n == 0 { return 1; }

	var sum: int = 0;
	for k in 0..(n-1) {
		sum += sigma(n-k) * part(k);
	}

	return sum / n;
}

proc helper(n: int): int { // A000700
	if n == 0 { return 1; }

	var sum: int = 0;
	for k in 1..n {
		sum += (if k % 2 == 0 then -1 else 1) * sumodd(k) * helper(n-k);
	}

	return sum / n;
}

var n: int;
n = stdin.read(int);

write((part(n) - helper(n)) / 2);

Should be pretty self-explanatory. I'm surprised such a nice language was available for so long.

Try it online!

Next sequence!

133. CHICKEN Scheme, 643 bytes, A000903

(define (g x) 
(cond ((= x 0) 1) (else x)))
(define (div4 x)
(/ (- x (remainder x 4)) 4))
(define (factorial x)
(cond ((< x 3) (g x)) 
(else (* x (factorial (- x 1))))))
(define (a37223 x)
(define y (/ (- x (remainder x 2)) 2))
(* (factorial y) (expt 2 y)))
(define (a37224 x) 
(define y (div4 x))
(cond ((> (remainder x 4) 1) 0) ((= x 1) 1) (else (/ (* 2 (factorial (- (* 2 y) 1))) (factorial (- y 1))))))
(define (a85 x)
(cond ((< x 2) 1) (else (+ (a85 (- x 1)) (* (- x 1) (a85 (- x 2)))))))
(define (a00000000000000000000000000000000000000903 x)
(cond ((= x 1) 1) (else (/ (+ (factorial x) (+ (a37223 x) (* 2 (+ (a37224 x) (a85 x))))) 8))))

Try it online!

Next Sequence

136. A Pear Tree, 232 bytes, A000029

The program contains unprintable characters, so here is the xxd:

00000000: 7573 6520 4d61 7468 3a3a 4e75 6d53 6571  use Math::NumSeq
00000010: 3a3a 546f 7469 656e 743b 7573 6520 504f  ::Totient;use PO
00000020: 5349 583b 246e 203d 2069 6e74 2824 5f29  SIX;$n = int($_)
00000030: 3b69 6628 246e 297b 2474 203d 204d 6174  ;if($n){$t = Mat
00000040: 683a 3a4e 756d 5365 713a 3a54 6f74 6965  h::NumSeq::Totie
00000050: 6e74 2d3e 6e65 7728 293b 666f 7228 2464  nt->new();for($d
00000060: 203d 2031 3b24 6420 3c3d 2024 6e3b 2464   = 1;$d <= $n;$d
00000070: 2b2b 297b 6966 2821 2824 6e20 2520 2464  ++){if(!($n % $d
00000080: 2929 7b24 7320 2b3d 2024 742d 3e69 7468  )){$s += $t->ith
00000090: 2824 6e2f 2464 292a 322a 2a28 2464 293b  ($n/$d)*2**($d);
000000a0: 7d7d 7072 696e 7420 2473 2f28 322a 246e  }}print $s/(2*$n
000000b0: 292b 2824 6e25 322b 3329 2f34 2a32 2a2a  )+($n%2+3)/4*2**
000000c0: 666c 6f6f 7228 246e 2f32 293b 7d65 6c73  floor($n/2);}els
000000d0: 657b 7072 696e 7420 313b 7d65 7869 7423  e{print 1;}exit#
000000e0: 8025 6b1b 0000 0000                      .%k.....

The bit at the end is just to have a CRC of 0, the rest is standard perl.

No TIO link because it uses the Math::NumSeq::Totient which isn't installed on TIO.

Next sequence!

131. Bean, 116 bytes, A000090

00000000: a64d a048 8040 a06a 52a0 6acc a06a 8d53  ¦M H.@ jR jÌ j.S
00000010: a048 4ca0 6a8c 253a 253a a64d a062 8050   HL j.%:%:¦M b.P
00000020: 80a0 1f20 803c a64d a05e 8053 a062 4ca0  . . .<¦M ^.S bL 
00000030: 438e 253c a64d a05f 804c d3a0 4820 5e8d  C.%<¦M _.LÓ H ^.
00000040: 53d0 80a0 1f20 8046 a53c 205e 264c ccd3  SÐ. . .F¥< ^&LÌÓ
00000050: a048 2043 8d53 a062 4ccc a05f 8e53 d080   H C.S bLÌ _.SÐ.
00000060: a01f 2080 3b4c a53a 8e25 3c8b 2581 008e   . .;L¥:.%<.%...
00000070: 205f ae35                                 _®5

Try it online!

Next sequence!

130. TI-Nspire CAS Basic, 90 bytes, A000482

Define f(n)=
Prgm
:Disp polyCoeffs(taylor((−ln(1-x))^(5),x,n),x)[1]*((n!)/(5!))
:EndPrgm

Next Sequence

Code in Action

Fun fact: I tried to implement 3 other sequences, but was too late as other answers had been made

129. ExtraC, 482 bytes, A000082

import math

int isprime(long n)do
	if(n equals 1) return 0
	if(n equals 2) return 1
	if(not(n modulus 2)) return 0
	long max be sqrt(n)
	for(long i be 2 AND i less max AND increment i)do
		if(not(n modulus (2 times i plus 1))) return 0
	end
	return 1
end

long n be readint plus 1
double r be 1
for(long p be 1 AND p minus 1 less n AND increment p)do
	if(not(n modulus p))do
		if(isprime(p))do
			r be r times (F(1) divide p plus 1)
		end
	end
end
print((int)(r times (n times n)))

Try it online!

Next sequence!

128. Groovy, 82 bytes, A000058

def a
a = { n,i=0G,x=2G -> 
	if (i == n) {
		x
	} else {
		a(n,i+1G,x*x-x+1G)
	}
}

The Gs indicate BigIntegers. Simple recursive implementation that counts from a(0) to a(n).

Try it online!

Next Sequence

127. Alice, 58 bytes, A000156

/o
\i@/1!&w]!k4Pt&wwh..*.&[?~&].hn6*&#2*?+!K;;[q$KW;e)[k[?

Try it online!

This uses a dynamic programming approach to compute the number of ways to compute m with k squares for all m <= n+1. Using n+1 instead of n allows me to avoid using a conditional when n=0.

Next sequence

126. Scala, 156 bytes, A000655

object Main extends App{
	val a=Console.readInt
	if (a == 0) { print(1) }
	else if (a == 1) { print(3) }
	else if (a == 2) { print(5) }
	else { print(4) }
}

Try it online!

Next Sequence

125. BeanShell, 655 bytes, A000796

import java.math.*;I=new Scanner(System.in).nextInt();D=I+9;O=BigDecimal.ONE;T=O.add(O);N=BigDecimal.TEN;C=new MathContext(2*D,RoundingMode.HALF_DOWN);z(a,b){return a.subtract(b,C).abs(C).compareTo(O.divide(N.pow(D,C)))>-1;}bsqrt(c){x=O;do{x=x.add(x.pow(2,C).add(c.negate(C),C).divide(x.multiply(T,C),C).negate(C),C);}while(z(x.pow(2,C),c));return x;}s=BigDecimal.ZERO;a=O;b=bsqrt(T);for(int i=1;z(a,b);i++){g=a.multiply(b,C);a=a.add(b,C).divide(T,C);b=bsqrt(g);s=s.add(T.pow(i,C).multiply(a.pow(2,C).subtract(g,C),C),C);}print(T.multiply(a.pow(2,C),C).divide(O.subtract(s,C),C).multiply(N.pow(I,C),C).toBigInteger().remainder(BigInteger.TEN).toString());

Try it online!

Next sequence! (easy sequence again)

BeanShell is just an interpreted Java with weak typing, so a high byte count is expected. I probably could golf it more by omitting the MathContext in some BigDecimal calls, but this would have to be tested empirically, which, with the probability of introducing inaccuracies for higher inputs is, in my opinion, not worth the risk. Also prints the input for some reason. This is probably unfixable: input test on TIO.

Square root implementation heavily based on this stackoverflow answer, the pi calculation itself on this Python + mpmath article.

123. Emojicode, 278 bytes, A002057

🐋🚂🍇
 🐖🅱️➡🚂🍇
  🍮p 1.0
  🔂k⏩2➕1🐕🍇
   🍮✖p➕➗🚀🐕🚀k 1
  🍉
  🍎🏇p
 🍉
 🐖🅰️➡🚂🍇
  🍎➗✖🅱️➕🐕1✖2🐕➕3🐕
 🍉
🍉

🏁🍇
 😀🔡🅰️➕1🍺🚂🔷🔡😯🔤🔤10 10
🍉

Try it online!

Next sequence! (have an easy one)

This is Emojicode 0.5, which is currently the newest version, but I'm mentioning it because of the major changes that are planned for 0.6.

Explaination:

Note: a lot of emoji choice doesn't make much sense in Emojicode 0.5. It's 0.x, after all. 0.6 will fix this, so if you want to learn this (because who wouldn't want to), I recommend waiting a moment.

Emojicode is an object-oriented programming language featuring generics, protocols, optionals and closures, but this program uses no closures and all generics and protocols can be considered implicit, while the only optional appears in the I/O part.

The program operates on only a few types: 🚂 is the integer type, 🚀 is the floating-point type, 🔡 is the string type and ⏩ is the range type (yes, a range is a type in Emojicode).

There are currently no operators in Emojicode, so addition, comparsions and other operations that are normally operators are implemented as functions, effectively making the expressions use prefix notation. Operators are also planned in 0.6.

🐋🚂🍇 ... 🍉

Extend the 🚂 type. This is a feature that is not commonly found in programming languages. Instead of creating a new class with 🚂 as the superclass, 🐋 modifies 🚂 directly. Grapes and watermelons declare code blocks in Emojicode.

🐖🅱️➡🚂🍇 ... 🍉

🅱️ is a method that returns 🚂. 🅱️ calculates A000108 using the Product_{k=2..n} (1 + n/k). The OEIS states that the formula is only valid for n > 1, but this method will only be called with n >= 1 and the value is ignored in the n = 1 case because of a multiplication by 0, so no special case is present.

🍮p 1.0

Create a variable named p and set it to 1.0. This automatically makes the type 🚀. This is necessary because fractions are present in the product.

🔂k⏩2➕1🐕🍇 ... 🍉

🔂 iterates over anything that implements the 🔂🐚⚪️ protocol, while ⏩ is a range literal that happens to implement 🔂🐚🚂. A range has a start value, a stop value and a step value, which is assumed to be 1 if start < stop, or -1 otherwise. One can also specify the step value by using the ⏭ to create the range literal. The start value is inclusive, while the stop value is exclusive, so this is equivalent to for k in range(2, ➕1🐕). ➕ is a method of the 🚂 type that adds numbers together and 🐕 refers to the object the method was called on, so ➕1🐕 means n + 1. This corresponds to the range of Product_{k=2..n} from the formula, since the stop value is not included in the range.

🍮✖p ...

This is an assignment by call, which means "call ✖ on p with the arguments (...) and set p to the return value". ✖ is a method of 🚀 that multiplies numbers together. This can sound familiar, because it's similar to the operators like +=, *= or >>= in some popular emoji-free (and therefore inferior) languages.

➕➗🚀🐕🚀k 1

🚀, in addition to being a type, is a method of the 🚂 type, that returns a 🚀 of the same value as 🚂 - by convention, methods that share the name with a type are used to convert to that type. Therefore this expression represents (n / k) + 1, which is then multiplied by, and stored in p.

🍎🏇p

🍎 is used to return values from methods, while 🏇 is a method of the 🚀 type that returns the nearest 🚂. Whether one uses an equivalent of round, floor or ceil shouldn't matter since the formula always results in integers, but using 🏇 makes the code more immune to floating-point inaccuracies.

🐖🅰️➡🚂🍇 ... 🍉

This creates a method named 🅰️ that returns 🚂. This method implements A002057.

🍎➗✖🅱️➕🐕1✖2🐕➕3🐕

This is a return statement with the formula "encoded" in prefix notation. If you decipher it, you'll see 🅱️ being called on n + 1, the result multiplied by 2 * n and divided by n + 3, resulting in the formula 2*n*A000108(n+1)/(n+3) from the OEIS.

🏁🍇 ... 🍉

🏁 marks the equivalent of a main function.

😀🔡🅰️➕1🍺🚂🔷🔡😯🔤🔤10 10

Let's break it down.

🔷🔡😯🔤🔤

🔤 marks the beginning and end of a 🔡 literal. 🔷 is used for constructing objects, so this creates a 🔡 with the constructor 😯 called with a single argument of an empty string. 😯 is used to read a line of input from the user, and the argument is used as a prompt.

🚂🔷🔡😯🔤🔤10

🚂 is a method of the 🔡 type, and as you might guess, it converts the string into an integer. It takes one argument, the number base to use.

🍺🚂🔷🔡😯🔤🔤10

🚂 returns an optional, 🍬🚂. Optionals can contain a value of the base type or nothingness, ⚡. When the string doesn't contain a number, ⚡ is returned. To use the value of an optional, one has to unwrap it using 🍺, which raises a runtime error if the value is ⚡. Normally it is bad practice to unwrap an optional without checking, but this is codegolf.SE, we don't care. If you want to see an example with error checking, see my answer at this challenge.

➕1🍺🚂🔷🔡😯🔤🔤10

The formula used for A002057 appears to have an off-by-one error, so 1 is added to the input to make the offset correct.

🅰️➕1🍺🚂🔷🔡😯🔤🔤10

🅰️ is called on the corrected input, calculating the sequence.

🔡🅰️➕1🍺🚂🔷🔡😯🔤🔤10 10

You guessed it. 🔡 is a method of the 🚂 type that converts it to a 🔡, taking the base as an argument.

😀🔡🅰️➕1🍺🚂🔷🔡😯🔤🔤10 10

Finally, 😀 is used to print the result.

122. MIT/GNU Scheme, 2057 bytes, A000525

So I'm implementing A000081 again...

(define (add f g)
  (stream-map + f g) )

(define (scale c f)
  (stream-map (lambda (v) (* c v)) f) )

(define (adddiag sf)
  (let ((f0 (stream-first sf)))
    (cons-stream (stream-first f0)
         (add (stream-rest f0) (adddiag (stream-rest sf))) ) ) )

(define (mult f g)
  (adddiag (stream-map (lambda (v) (scale v g)) f)) )

(define (prependzeros n f)
  (if (= 0 n) f (cons-stream 0 (prependzeros (-1+ n) f))) )

(define (intersperse f n)
  (cons-stream (stream-first f)
           (prependzeros n (intersperse (stream-rest f) n)) ) )

(define (iterate fun init)
  (cons-stream init (iterate fun (fun init))) )

(define (from n)
  (cons-stream n (from (1+ n))) )

(define (scanl fun init s)
  (cons-stream init (scanl fun (fun init (stream-first s)) (stream-rest s))) )

(define (expx f)
  (cons-stream 1
           (adddiag (stream-map (lambda (s g) (scale (/ 1 s) g))
                    (scanl * 1 (from 2))
                    (iterate (lambda (g) (mult f g)) f) )) ) )

(define (eu f)
  (expx (adddiag (stream-map (lambda (n) (scale (/ 1 n)
                                                (intersperse f (-1+ n)) ))
                             (from 1) ))) )

(define gf000081s (cons-stream 1 (stream-rest (eu gf000081s))))

(define gf000081 (cons-stream 0 gf000081s))

(define (recip1 f)
  (let ((msf (scale -1 (stream-rest f))))
    (cons-stream 1 (adddiag (iterate (lambda (g) (mult msf g)) msf))) ) )

(define (div1 f g)
  (mult f (recip1 g)) )

(define (pow7 f)
  (let* ((p2 (mult f f))
         (p4 (mult p2 p2))
         (p6 (mult p4 p2)) )
    (mult p6 f) ) )

(define (addconst c f)
  (cons-stream (+ c (stream-first f))
               (stream-rest f) ) )

(define gf
  (let* ((p2 (mult gf000081 gf000081))
         (p3 (mult p2 gf000081))
         (p4 (mult p3 gf000081)) )
    (div1 (mult p4 (addconst 64
                             (add (add (scale -79 gf000081)
                                       (scale  36 p2) )
                                  (scale -6 p3) ) ))
          (pow7 (addconst 1 (scale -1 gf000081))) ) ) )

(define (f n) (stream-ref gf (+ 4 n)))

In debian, MIT/GNU Scheme is in the package mit-scheme.

Here's how to use it when the program is in a file ps.scm:

$ scheme --load ps.scm
MIT/GNU Scheme running under GNU/Linux
[...]
1 ]=> (f 20)

;Value: 90039381031273

Next sequence

118. Ly, 128 bytes, A000106

1<n
[>&sy0>lr>l
 [&s>lrysp>l[:lf%:[pp0f10]p![p:0]p1-]p
  <<<0>>[sp>l*sp<<<l+>>]
  <p<*sp<l+>>]
 <<f/<1-]
>&s>lr[sp<l*sp<l+>>]<<u

Next sequence

Try it online!

Easy: just compute values for 1 to n+1 of A000081, then convolve. You may notice that I'm not using Ly's indexing operator I, I'm more thinking in terms of what Haskell calls zipWith. It's a pitty that the division makes Ly use floating point.

The next sequence is a bit simple, I apologize.

120. MATL, 22 bytes, A000139

ttQ:pw2*Q:p*3G*:p2*w/&

Next Sequence

Try it online!

119. bc, 139 bytes, A000128

Next Sequence

define f(x) {
	a = 0
	b = 1
	for (i=0; i<x; ++i) {
		aux = b
		b = a + b
		a = aux
	}
	return a
}
n = read()
f(n+5) - (n+1) * (n+2) / 2 - 3

Try it online!

117. Rail, 106 bytes, A001156

$'g'
 -13{f}#
$'f'
 \  /(y)(x){f}(z)(y)s(y)(x)-@
  -*(!z!)(!y!)(!x!)(y)(x)g<
 @-(z)a2(z)a{f}a----#-q0(x)-@

The function named g defined at the top is the function that computed the sequence. f is a helper function that you shouldn't call directly.

Try it online!

Next Sequence (more math! Yay!)

116. Kotlin, 1156 bytes, A000273

import java.math.BigInteger;

fun main(args: Array<String>) {
    val n = Integer.valueOf(args[0]);
    var a = accum(n, n, Array(n, { x -> 0 }), Array(n, { x -> 0 }), 0, BigInteger.ONE, n);
    println(a.first / a.second);
}

fun accum(n: Int, m: Int, part: Array<Int>, freq: Array<Int>, off: Int, c: BigInteger, omega: Int): Pair<BigInteger, BigInteger> {
    if (n == 0) return Pair(BigInteger.ONE.shiftLeft(omega), c);
    if (m == 0) return Pair(BigInteger.ZERO, BigInteger.ONE);

    var sum = accum(n, m - 1, part, freq, off, c, omega);
    part[off] = m;
    freq[off] = 0;
    var c1 = c;
    var omega2 = omega;

    var delta = -1;
    var j = 0;
    while (j < off) delta += 2 * freq[j] * gcd(part[j++], m);

    var im = m;
    while (im <= n) {
        freq[off]++;
        c1 = c1 * BigInteger.valueOf(im.toLong());
        omega2 = omega2 + 2 * (im - m) + delta;
        val term = accum(n - im, m - 1, part, freq, off + 1, c1, omega2);
        sum = Pair(sum.first * term.second + sum.second * term.first, sum.second * term.second);
        im += m;
    }

    return sum;
}

fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)

Online demo

Next sequence is a nice easy partition sequence.

Notes

This implementation follows J. Qian, Enumeration of unlabeled directed hypergraphs, Electronic Journal of Combinatorics, 20(1) (2013), and in particular exploits corollary 6. Although it may not look it, it's much simpler than the Maple implementation listed in OEIS.

115. shortC, 273 bytes, A001560

pa(m){Fm%2){T-1;}E{T1;}}
pt(m){Ii,p[200],s,j,k,t,kk;p[0]=1;for(i=1;i<=m;i++){j=1;k=1;s=0;Wj>0){kk=k*k;j=i-(3*kk+k)/2;t=pa(k);if(j>=0){s=s-t*p[j];}j=i-(3*kk-k)/2;Fj>=0){s=s-t*p[j];}k=k+1;}p[i]= s;}Ts}
AIi,c;scanf("%d",&c);Oi=0;i<131;i++){Fpt(i)%2==0)c--;Fc==1)break;}R"%d",i

Next sequence and Try it online!

It's surprisingly hard to calculate partitions in a language that doesn't have many math builtins. This could be more golfed, but it could also be a lot less golfed. :P

114. Crystal, 1560 bytes, A000228

Dirs = [0,1,-1].permutations.to_a

def addhp(a,b)
  (0..2).map{ |i| a[i]+b[i] }
end

def hexh(n,use,seen,possible)
  if n==0
    testhex(use) ? 1 : 0
  else
    if possible.empty?
      0
    else
      elem = possible[0]
      remain = possible[1..-1]
      newseen = [elem]+seen
      c = hexh(n,use,newseen,remain)
      newpossible = Dirs.map{ |d| addhp(elem,d) }
      newpossible = newpossible.select \
         { |p| ! ((seen.includes? p) || (remain.includes? p)) }
      c + hexh(n-1,use+[elem],newseen,remain+newpossible)
    end
  end
end

def hex(n)
  empty = [] of Array(Int32)
  hexh(n,empty,empty,[[0,0,0]])
end

def rot(hl)
  hl.map{ |h| h.rotate }
end

def neg(hl)
  hl.map{ |h| h.map{ |v| -v } }
end

def mirr(hl)
  hl.map{ |h| [0,2,1].map{ |i| h[i] } }
end

def normhex(hl)
  x = hl.map{ |h| h[0] }.min 
  hl = hl.map{ |h| addhp(h,[-x,0,x]) }
  x = hl.map{ |h| h[1] }.min
  hl.map{ |h| addhp(h,[0,-x,x]) }
end

def check(shl,chl)
  ( shl <=> chl.sort ) == 1
end

def testonesided(hl,ohl)
  return false if check(hl,ohl)
  nhl = normhex(rot(ohl))
  return false if check(hl,nhl)
  nhl = normhex(rot(nhl))
  return false if check(hl,nhl)
  nhl = normhex(neg(ohl))
  return false if check(hl,nhl)
  nhl = normhex(rot(nhl))
  return false if check(hl,nhl)
  nhl = normhex(rot(nhl))
  return false if check(hl,nhl)
  true
end

def testhex(hl)
  hl = normhex(hl)
  return false if hl[0] != hl.min
  hl.sort!
  mhl = normhex(mirr(hl))
  testonesided(hl,hl) && testonesided(hl,mhl)
end

n = ARGV.size==1 ? ARGV[0].to_i : 7
puts "f(#{n}) = #{hex(n)}"

Next sequence

Try it online!

This is a full program that takes input from the command line and computes the value for n=7 if no argument was given, because that has a nice value. I don't really know this language, it may show. And I don't know how to give command line arguments to TIO, you may just replace the assignment to n in the line before the last one instead.

Strangely, it compiles fine (on old debian jessie using crystal's external debian repository) with crystal build hex.cr, but the optimizing call crystal build hex.cr --release fails with what seems to be an internal error.

113. Arcyóu, 228 bytes, A000049

(: grp (F(d) d))
(: q (# (q)))
(: t (? q (] 
 (r * (* (_ 2 3) q))) 2))
(: a 0)
(f x (_ 1 t) (grp
 (: b 0)
 (f y (_ t) (grp
  (f z (_ t) (grp
   (? (= (+ (* 3 (* y y)) (* 4 (* z z))) x) (: b 1) 1)
  ))
 ))
 (: a (+ a b))
))
(p a)

This is slow for terms past about the fifth, but Arcyóu is implemented in Python, which does support arbitrary precision numbers. Try it online!

Next sequence (let's try some geometry ...)

112. Retina, 49 bytes, A000042

.+
$*
$(Let's just add some padding here, yes)?
1

The extra part at the end is for it to be 0-indexed, to comply with the spec.

Try it online!

Next Sequence

111. Ceres, 42 bytes, A000442

!3*@                                      

Try it online!

Spacing is to get an unused easy sequence. Many trailing spaces...

Note that this works for very large values because Python and sympy, though it doesn't look like it because of printing...

Next Sequence

110. Nim, 442 bytes, A000081

from strutils import parseint
import math

proc A000081(index: int): int =
 if index <= 0: return 0
 elif index <= 2: return 1
 elif index == 3: return 2
 elif index == 4: return 4
 else:
  var n: int = index - 1
  result = 0
  for k in 1..n:
   var t: int = 0
   for d in 1..k:
    if gcd(d,k)==d:
     t = t + (d * A000081(d))
   result = result + t*A000081(n-k+1)
  result = int(result / n)
 return

echo A000081(parseint(readline(stdin)))

Try it online!

Next sequence

109. brainfuck, 81 bytes, A000032

,>+>>++>+<<<<[>-<-[>>>>[-<<+<+>>>]<[-<+>]<<[->>+<<]>[->>+<<]<<-]>>>>.<<<]>[+.--]+

Try it online!

Input with raw bytes, or Unicode codepoints, whatever your interpreter supports. Requires large cells for larger inputs. TIO uses Python with an interpreter modified to do input in numbers instead of raw bytes to make testing easier. I probably could golf it down further, but I'm lazy.

Next sequence!

108. Proton, 32 bytes, A001589

a => ((4&(**),(**)&4) + *(+))(a)

Try it online!

Next Sequence

The shortest working solution would probably be a=>a**4+4**a :P

107. TrumpScript, 1589 bytes, A000047

My cat hears everything really well
because with me every cat is a safe cat
Everybody knows that one is 1000001 minus 1000000
but only most of you that two is, one plus one;
As always nothing is, one minus one;
My dog is one year old.
I promise you that as long as you vote on me, nothing will be less cool than a cat;:
Much dog is, dog times two;
Dead cat is, cat minus one;!
I will make dog feel good, food for dog plus one;
Roads can be made using different things. Asphalt is one of them.
As long as Hillary jailed, I love asphalt less than my dog;:
Roads are, always made using asphalt plus one of other things;
I promise my roadways are, two times asphalt than you want;
My roadways are great, always roadways plus one;
Vladimir is nothing more than my friend.
Name of Putin is Vladimir.
As long as, Putin eat less roadways;:
China is nothing interesting.
We all know people speaking Chinese are from China.
As long as, Chinese makes less roads;:
I will make economy, for Putin - Chinese will love me;
If it will mean, economy is asphalt in Russia?;:
I will make cat feel good, cat plus one dollar on food;
Make Vladimir roadways to help Russia economy.
Never make china roads!
I show you how great China is, China plus one; You can add numbers to China.
Like Chinese is, China times China makes sense;
Like Chinese is, two times Chinese letter;!
Make Vladimir happy, Vladimir plus one million dollars;
I also show you how great Putin is, Vladimir times Vladimir; You can do number stuff to Putin too!
I will make asphalt roads a lot!
Everybody say cat. You did it? America is great.

Try it online!

First time programming in TrumpScript, it is possible that I reinvented the wheel a few times - 4 lines are dedicated to calculating 2 ^ n. I tried to make it look like something that (drunk) Trump could say. As a bonus, here is a Python script I wrote to verify that I'm doing everything right. There are some differences to the above program, but much of it is directly equivalent.

cat = int(input())
dog = 2 ** cat + 1
asphalt = 1
cat = 0
while asphalt < dog:
    roads = asphalt + 1
    roadways = 2 * asphalt + 1
    vladimir = 0
    putin = vladimir
    while putin < roadways:
        china = 0
        chinese = china
        while chinese < roads:
            chair = putin - chinese
            if chair == asphalt:
                cat += 1
                vladimir = roadways
                china = roads
            china += 1
            chinese = 2 * china * china
        vladimir += 1
        putin = vladimir * vladimir
    asphalt = roads
print(cat)

Next sequence!

101. Fortress, 335 bytes, A000020

relativelyPrime(a,b)=array[\ZZ32\]((a MIN b)-1).fill(fn(n)=>1) EQ array[\ZZ32\]((a MIN b)-1).fill(fn(n)=>if ((a MOD (n+2))+(b MOD (n+2))) NE 0 then 1 else 0 end)
totient(n)= do
 S : ZZ32 = 0
 for i <- 1:n do
  S += if relativelyPrime(i,n) then 1 else 0 end
 end
 S
end
A000020(n) = do
 |\if n = 1 then 2 else totient(2^n-1)/n end/|
end

Next Sequence

Direct download of Fortress

If the language was equivalent to the specification at the time that FOrtress got axed, then this would probably be easy. But sadly, Fortress got the boot, and I'm stuck with this crap >_<.

106. Objective-C (clang), 45 + 2 = 47 bytes, A000193

int f(int x){ return (int) round(log(x+1)); }

Try it online!

I don't really know Objective-C, but I got something working. Needs the -lm flag (no clue why, but it doesn't work without it).

Does what it says on the tin - rounds the log of the input. Note that it adds 1 to the input to make the sequence 0-indexed.

Next Sequence

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 nextIter
echo %last%

Next sequence

Takes the input number as a command line argument, and prints the result.

Run by saving the above as a .bat file, and execute with windows command prompt (if anyone knows of an online interpreter, I'm happy to update).

Uses an iterative method of computing square roots (Newton's method, I think?). It finds the floor of the square root, which is just what we need for this sequence.

104. Vala, 267 bytes, A000713

static int main(string[] args) {
	int n = int.parse(stdin.read_line());
	int[] a = new int[n+1];
	a[0] = 1;
	for(int i=1;i<=n;i++){
		int iter = i==1?3:2;
		for(int j=0;j<iter;j++)
			for(int k=i;k<=n;k++) a[k] += a[k-i];
	}
	stdout.printf("%d\n", a[n]);
	return 0;
}

Try it online!

Next sequence.

Explanation

Uses the g.f. 1/[(1-x)^3 (1-x^2)^2 (1-x^3)^2 (1-x^4)^2 ...].

22. FiM++, 982 bytes, A000024

Note: if you are reading this, you might want to sort by "oldest".

Dear PPCG: I solved A000024!

I learned how to party to get a number using the number x and the number y.
Did you know that the number beers was x?
For every number chug from 1 to y,
  beers became beers times x!
That's what I did.
Then you get beers!
That's all about how to party.

Today I learned how to do math to get a number using the number n.
Did you know that the number answer was 0?
For every number x from 1 to n,
  For every number y from 1 to n,
    Did you know that the number tmp1 was how to party using x and 2?
    Did you know that the number tmp2 was how to party using y and 2?
    Did you know that the number max was how to party using 2 and n?
    tmp2 became tmp2 times 10!
    tmp1 became tmp1 plus tmp2!
    If tmp1 is more than max then: answer got one more.
  That's what I did.
That's what I did.
Then you get answer!
That's all about how to do math.

Your faithful student, BlackCap.

PS:  This is the best answer
PPS: This really is the best answer

Next sequence

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) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x1
        While x1 ^ (2 / 3) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x2
            While x1 ^ (2 / 3) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x3
                A000158 = A000158 + 1
                x3 = x3 + 1
            Wend ' x3
            x2 = x2 + 1
            x3 = x2
        Wend ' x2
        x1 = x1 + 1
        x2 = x1
        x3 = x2
    Wend ' x1

    ' no need to return; VB6 will return the value of the variable A000158 (same name as the function)
End Function

Next Sequence

This is a function which takes n as an input and returns a value back to the caller. Used in the manner of answer = A000158(input).

VB6 shares a lot of the syntax with VB.NET, but use completely different compilers (and some different syntaxes).

VB6 longs are actually 32 bit integers.

Unlike C based languages, the / is floating point division. Integer division is handled by \. So 1 / 2 will give 0.5.

The ^ is actually exponent, and not xor like a lot of languages. I believe Xor is the VB6 xor.

VB6 has an implicit variable inside their functions that share the same name. So instead of saying Return <value>, you assign the return value to the function name. In this instance, I set the variable A000158 with my return value. After execution, the value of A000158 is given back to the caller.

Example usage:

I created a new form in the VB6 IDE, dropped two text boxes and a button in it (didn't change the form field names).

Private Sub Command1_Click()
    Text2.Text = A000158(Text1.Text)
End Sub

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) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x1
        While x1 ^ (2 / 3) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x2
            While x1 ^ (2 / 3) + x2 ^ (2 / 3) + x3 ^ (2 / 3) <= n ' x3
                A000158 = A000158 + 1
                x3 = x3 + 1
            Wend ' x3
            x2 = x2 + 1
            x3 = x2
        Wend ' x2
        x1 = x1 + 1
        x2 = x1
        x3 = x2
    Wend ' x1

    ' no need to return; VB6 will return the value of the variable A000158 (same name as the function)
End Function

Type a value into TextBox1, hit the Button1, and watch TextBox2 get populated by the result.

102. Perl 5, 158 bytes, A000335

@b[0]=1;
while($n++<=$ARGV[0]){
  for($d=1;$d<=$n;$d++){
    for($k=$d;$k<=$n;$k+=$d){@b[$n]+=$d*$d*($d+1)*($d+2)/6*@b[$n-$k]}
  }
  @b[$n]/=$n
}
print @b[-1]

Online demo. This is a full program which takes input as a command-line parameter.

Next Sequence

100. Pyke, 20 bytes, A000030

Yaay, the 100th answer! 0-indexed.

                  `h

Try it online!

Next Sequence.

97. Python 3 (PyPy), 1772 bytes, A000236

First of all, many thanks to Dr. Max Alekseyev for being patient with me. I'm very fortunate that I was able to contact him by email to understand this challenge. His Math.SE answer here helped me out a lot. Thanks to Wheat Wizard for helping me as well. :)

plist = []

def primes(maximal = -1): # Semi-efficient prime number generator with caching up to a certain max.
	index = plist and plist[-1] or 2
	for prime in plist:
		if prime <= maximal or maximal == -1: yield prime
		else: break
	while index <= maximal or maximal == -1:
		composite = False
		for prime in plist:
			if index % prime == 0:
				composite = True
				break
		if not composite:
			yield index
			plist.append(index)
		index += 1

def modinv(num, mod): # Multiplicative inverse with a modulus
	index = 1
	while num * index % mod != 1: index += 1
	return index

def moddiv(num, dnm, mod):
	return num * modinv(dnm, mod) % mod

def isPowerResidue(num, exp, mod):
	for base in range(mod):
		if pow(base, exp, mod) == num:
			return base
	return False

def compute(power, prime):
	for num in range(2, prime):
		if isPowerResidue(moddiv(num - 1, num, prime), power, prime):
			return num - 1
	return -1

# file = open('output.txt', 'w')

def output(string):
	print(string)
	# file.write(str(string) + '\n')

def compPrimes(power, count):
	maximum = 0
	index = 0
	for prime in getValidPrimes(power, count):
		result = compute(power, prime)
		if result > maximum: maximum = result
		index += 1
		# output('Computed %d / %d = %d%% [result = %d, prime = %d]' % (index, count, (100 * index) // count, result, prime))
	return maximum

def isValidPrime(power, prime):
	return (prime - 1) % power == 0

def getValidPrimes(power, count):
	collected = []
	for prime in primes():
		if isValidPrime(power, prime):
			collected.append(prime)
		if len(collected) >= count:
			return collected
		# output('Collected %d / %d = %d%% [%d]' % (len(collected), count, (100 * len(collected)) // count, prime))

power = int(input()) + 2

output(compPrimes(power, 100))

# file.close()

Try it online!

If it gives the wrong result, just increase the 100 to something larger. I think 10000 will work for 4 but I'll leave my computer running overnight to confirm that; it may take a couple of hours to finish.

Note that the (PyPy) part is just so that I can use Python again. I really don't know many other languages and I'm not going to try to port this to Java and risk not finishing in time.

Next Sequence (Also please don't do any more crazy math stuff; I don't have any Python versions left so someone else will have to save this challenge D:)

99. Spaced, 30 bytes, A000153

$<2?$: $*f($-1) + ($-2)*f($-2)

Try it online!

Next sequence

98. Befunge-98 (PyFunge), 153 bytes, A001772

&v >1 >1+:00g\%kvv>1\>1-\2*\:kvv
 #   vw\-1g00: < >$v ^       < $
>0p^ >$01g1-:01v> #> > 1+vv-1*b<
^>1+01p         ^ ^:     <>0
               >p  k^.@zz

Try it online! The two zs after the @ are nop's that never get executed but I added in the make the bytecount correspond to an easier sequence. Becuase of what I think is a quirk of the interpreter and the fact that TIO doesn't provide a trailing newline, input needs to be given with a trailing space.

Next sequence

94. Befunge 93, 27 bytes, A000035

>  &   v
v  2   <
>  % . @@

Try it online!

Next Sequence... How about a REALLY easy one??? :P

Golfed solution: &2%.@

96. Common Lisp, 236 bytes, A000478

(defun power(m n)
  (let ((result 1))
    (dotimes (count n result)
             (setf result (* m result)))))
(defun solve(n) (+ (- (/ (+ 7 n (* (+ 6 n) (+ 6 n))) 2) (* (+ .5 (/ (+ 6 n) 4)) (power 2 (+ 5 n)))) (/ (power 3 (+ 6 n)) 6)))

Try it online!

Some code copied from this StackOverflow question. This is a trivial conversion of the formula specified in the comments of the sequence into lisp.

Next sequence

95. Taxi, 478 bytes, A000027

Go to Post Office:w 1 l 1 r 1 l.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:s 1 l 1 r.
Pickup a passenger going to Addition Alley.
1 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 l 1 l 1 l 2 l.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:w 1 r 1 l 1 r 3 r 1 r.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery:n 1 r 1 r.
Pickup a passenger going to Post Office.
Go to Post Office:n 1 l 1 r.

Adds 1 to the input, since this has to be 0-based.

Try it online!

Next Sequence

93. Clojure, 35 bytes, A000093

#(Math/floor (Math/sqrt (* % % %)))

Try it online!

Next Sequence

92. Thue, 93 bytes, A001733

0::=~7
1::=0
2::=0
3::=~10
4::=aa
5::=~12
6::=~13
7::=~21
8::=aaa
9::=88a
a::=~1
b::=:::
::=
b

This does hardcode the values, but that shouldn't be a problem, as it is not possible to encode a number in base -1.

Next sequence

91. Python 2 (PyPy), 1733 bytes, A000066

import itertools

girth = int(input()) + 3

v = 4

r = range

def p(v):
	a = [0 for i in r(v)]
	k = int((v * 2) ** .5)
	a[k - 1] = a[k - 2] = a[k - 3] = 1
	j = len(a) - 1
	for i in r(1, 3):
		a[j] = 1
		j -= i
	yield [x for x in a]
	while not all(a):
		for index in r(len(a) - 1, -1, -1):
			a[index] ^= 1
			if a[index]: break
		yield [x for x in a]

def wrap_(p, v):
	m = [[0 for j in r(v)] for i in r(v)]
	k = 0
	for i in r(0, v - 1):
		for j in r(i + 1, v):
			m[i][j] = m[j][i] = p[k]
			k += 1
	return m

def completes_cycle(edgelist):
	if not edgelist or not edgelist[1:]: return False
	start = edgelist[0]
	edge = edgelist[0]
	e = [x for x in edgelist]
	edgelist = edgelist[1:]
	while edgelist:
		_edges = [_edge for _edge in edgelist if _edge[0] in edge or _edge[1] in edge]
		if _edges:
			edgelist.remove(_edges[0])
			if _edges[0][1] in edge: _edges[0] = (_edges[0][1], _edges[0][0])
			edge = _edges[0]
		else:
			return False
	flat = sum(e, ())
	for i in flat:
		if flat.count(i) != 2: return False
	return edge[1] in start

def powerset(a):
	return sum([list(itertools.combinations(a, t)) for t in r(len(a))], [])

while True:
	ps = (v * (v - 1)) // 2
	skip = False
	for Q in p(ps):
		m = wrap_(Q, v)
		output = [row + [0] for row in m]
		output.append([0 for i in r(len(m[0]))])
		for i in r(len(m)):
			output[i][-1] = sum(m[i])
			output[-1][i] = sum(row[i] for row in m)
		if all(map(lambda x: x == 3, map(sum, m))):
			edges = []
			for i in r(v):
				for j in r(i, v):
					if m[i][j]: edges.append((i, j))
			for edgegroup in powerset(edges):
				if completes_cycle(list(edgegroup)):
					if len(edgegroup) == girth:
						print(v)
						exit(0)
					else:
						skip = True
						break
		if skip: break
	v += 1

Try it online!

I hope using Python 2 PyPy counts as another major version. If someone could get me a Python 0 interpreter, I could use that too, but I hope this is valid.

This starts at 1 vertex and works up, creating the adjacency matrix representation of every possible undirected graph with that many vertices. If it is trivalent, then it will look through the powerset of the edges, which will be sorted by length. If the first cycle it finds is too short, then it will move on. If the first cycle it finds matches the input (offset by 3) then it will output the correct vertex count and terminate.

Next Sequence <-- have an easy one as a break from all this math nonsense :D

EDIT: I added some optimizations to make it a bit faster (still can't compute the third term within TIO's 60 second limit though) without changing the bytecount.

40. Rust, 3416 bytes, A000001

The rules seem to imply hardcoding the first 1001 cases is fine.

EDIT: I’m editing this post to give some commenters the chance to adjust their vote on it.

static COUNT: [i32; 1001] =
[0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2,
1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4,
2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4, 267, 1,
4, 1, 5, 1, 4, 1, 50, 1, 2, 3, 4, 1, 6, 1, 52, 15, 2, 1, 15, 1, 2, 1,
12, 1, 10, 1, 4, 2, 2, 1, 231, 1, 5, 2, 16, 1, 4, 1, 14, 2, 2, 1, 45,
1, 6, 2, 43, 1, 6, 1, 5, 4, 2, 1, 47, 2, 2, 1, 4, 5, 16, 1, 2328, 2,
4, 1, 10, 1, 2, 5, 15, 1, 4, 1, 11, 1, 2, 1, 197, 1, 2, 6, 5, 1, 13,
1, 12, 2, 4, 2, 18, 1, 2, 1, 238, 1, 55, 1, 5, 2, 2, 1, 57, 2, 4, 5,
4, 1, 4, 2, 42, 1, 2, 1, 37, 1, 4, 2, 12, 1, 6, 1, 4, 13, 4, 1, 1543,
1, 2, 2, 12, 1, 10, 1, 52, 2, 2, 2, 12, 2, 2, 2, 51, 1, 12, 1, 5, 1,
2, 1, 177, 1, 2, 2, 15, 1, 6, 1, 197, 6, 2, 1, 15, 1, 4, 2, 14, 1,
16, 1, 4, 2, 4, 1, 208, 1, 5, 67, 5, 2, 4, 1, 12, 1, 15, 1, 46, 2, 2,
1, 56092, 1, 6, 1, 15, 2, 2, 1, 39, 1, 4, 1, 4, 1, 30, 1, 54, 5, 2,
4, 10, 1, 2, 4, 40, 1, 4, 1, 4, 2, 4, 1, 1045, 2, 4, 2, 5, 1, 23, 1,
14, 5, 2, 1, 49, 2, 2, 1, 42, 2, 10, 1, 9, 2, 6, 1, 61, 1, 2, 4, 4,
1, 4, 1, 1640, 1, 4, 1, 176, 2, 2, 2, 15, 1, 12, 1, 4, 5, 2, 1, 228,
1, 5, 1, 15, 1, 18, 5, 12, 1, 2, 1, 12, 1, 10, 14, 195, 1, 4, 2, 5,
2, 2, 1, 162, 2, 2, 3, 11, 1, 6, 1, 42, 2, 4, 1, 15, 1, 4, 7, 12, 1,
60, 1, 11, 2, 2, 1, 20169, 2, 2, 4, 5, 1, 12, 1, 44, 1, 2, 1, 30, 1,
2, 5, 221, 1, 6, 1, 5, 16, 6, 1, 46, 1, 6, 1, 4, 1, 10, 1, 235, 2, 4,
1, 41, 1, 2, 2, 14, 2, 4, 1, 4, 2, 4, 1, 775, 1, 4, 1, 5, 1, 6, 1,
51, 13, 4, 1, 18, 1, 2, 1, 1396, 1, 34, 1, 5, 2, 2, 1, 54, 1, 2, 5,
11, 1, 12, 1, 51, 4, 2, 1, 55, 1, 4, 2, 12, 1, 6, 2, 11, 2, 2, 1,
1213, 1, 2, 2, 12, 1, 261, 1, 14, 2, 10, 1, 12, 1, 4, 4, 42, 2, 4, 1,
56, 1, 2, 1, 202, 2, 6, 6, 4, 1, 8, 1, 10494213, 15, 2, 1, 15, 1, 4,
1, 49, 1, 10, 1, 4, 6, 2, 1, 170, 2, 4, 2, 9, 1, 4, 1, 12, 1, 2, 2,
119, 1, 2, 2, 246, 1, 24, 1, 5, 4, 16, 1, 39, 1, 2, 2, 4, 1, 16, 1,
180, 1, 2, 1, 10, 1, 2, 49, 12, 1, 12, 1, 11, 1, 4, 2, 8681, 1, 5, 2,
15, 1, 6, 1, 15, 4, 2, 1, 66, 1, 4, 1, 51, 1, 30, 1, 5, 2, 4, 1, 205,
1, 6, 4, 4, 7, 4, 1, 195, 3, 6, 1, 36, 1, 2, 2, 35, 1, 6, 1, 15, 5,
2, 1, 260, 15, 2, 2, 5, 1, 32, 1, 12, 2, 2, 1, 12, 2, 4, 2, 21541, 1,
4, 1, 9, 2, 4, 1, 757, 1, 10, 5, 4, 1, 6, 2, 53, 5, 4, 1, 40, 1, 2,
2, 12, 1, 18, 1, 4, 2, 4, 1, 1280, 1, 2, 17, 16, 1, 4, 1, 53, 1, 4,
1, 51, 1, 15, 2, 42, 2, 8, 1, 5, 4, 2, 1, 44, 1, 2, 1, 36, 1, 62, 1,
1387, 1, 2, 1, 10, 1, 6, 4, 15, 1, 12, 2, 4, 1, 2, 1, 840, 1, 5, 2,
5, 2, 13, 1, 40, 504, 4, 1, 18, 1, 2, 6, 195, 2, 10, 1, 15, 5, 4, 1,
54, 1, 2, 2, 11, 1, 39, 1, 42, 1, 4, 2, 189, 1, 2, 2, 39, 1, 6, 1, 4,
2, 2, 1, 1090235, 1, 12, 1, 5, 1, 16, 4, 15, 5, 2, 1, 53, 1, 4, 5,
172, 1, 4, 1, 5, 1, 4, 2, 137, 1, 2, 1, 4, 1, 24, 1, 1211, 2, 2, 1,
15, 1, 4, 1, 14, 1, 113, 1, 16, 2, 4, 1, 205, 1, 2, 11, 20, 1, 4, 1,
12, 5, 4, 1, 30, 1, 4, 2, 1630, 2, 6, 1, 9, 13, 2, 1, 186, 2, 2, 1,
4, 2, 10, 2, 51, 2, 10, 1, 10, 1, 4, 5, 12, 1, 12, 1, 11, 2, 2, 1,
4725, 1, 2, 3, 9, 1, 8, 1, 14, 4, 4, 5, 18, 1, 2, 1, 221, 1, 68, 1,
15, 1, 2, 1, 61, 2, 4, 15, 4, 1, 4, 1, 19349, 2, 2, 1, 150, 1, 4, 7,
15, 2, 6, 1, 4, 2, 8, 1, 222, 1, 2, 4, 5, 1, 30, 1, 39, 2, 2, 1, 34,
2, 2, 4, 235, 1, 18, 2, 5, 1, 2, 2, 222, 1, 4, 2, 11, 1, 6, 1, 42,
13, 4, 1, 15, 1, 10, 1, 42, 1, 10, 2, 4, 1, 2, 1, 11394, 2, 4, 2, 5,
1, 12, 1, 42, 2, 4, 1, 900, 1, 2, 6, 51, 1, 6, 2, 34, 5, 2, 1, 46, 1,
4, 2, 11, 1, 30, 1, 196, 2, 6, 1,10,1,2,15,199];

fn count(i: usize) -> i32 { COUNT[i] }

Try it online!

Next sequence.

90. Open Shading Language (OSL), 66 bytes, A000201

shader abc(int i=1, output float o=1){o=floor(i*((1+sqrt(5))/2));}

Next Sequence

88. Go, 386 bytes, A000016

For those using graduation script, SE translates tabs into spaces.

import . "math"
func gcd (a, b int) int {
    for b != 0 { c := b; b = a % b; a = c }
    return a
}
func phi (n int) int{
    r := 1
    for i := 2; i < n; i++ { if gcd (i, n) == 1 { r++ } }
    return r
}
func f (n int) int {
    s := 0.
    for i := 1; i <= n; i++ {
        if (i % 2 == 1) && (n % i == 0) {
            s += (float64(phi(i)) * Pow(2., float64(n) / float64(i))) / float64(2 * n)
        }
    }
    return int(s)
}

Try it online!

Next Sequence.

87. Neim, 16 bytes, A000040

>𝐋1𝕗><><><><><><

Output is wrapped in braces []. Yes, those are random filler bytes (that increment and decrement continuously), but I like to think of them as fish having fun with code.

Try it online!

Next sequence.

85. TypeScript, 97 bytes, A000330

function f(i:number) {
 let s:number=0;
 for(let j:number=0;j<=i;j++){
  s+=j**2;
 }
 return s;
}

Try it online!

Next Sequence

84. Boo, 330 bytes, A165318

def f (n):
  cnt = 0
  i   = 1
  while true:
    i++
    isPrime = true
    for k in range(2, i):
      if i%k==0: isPrime = false
    if isPrime == false: continue
    divs = 0
    q    = i-1
    for k in range(1, i):
      if q%k == 0: divs = divs+1
    if (divs & (divs - 1)) != 0: continue
    if cnt == n: return i
    cnt++

Try it online!

Next sequence

83. Bash, 53+165265=165318, A000014

#!/bin/sh
read index
head -"$index" a.txt | tail -1

requires that a.txt (https://hastebin.com/eroterefov) be in the same directory

next sequence

Also, this is my first post to the Code Golf Stack Exchange, please let me know if I messed up in any way.

82. Cubix, 14 bytes, A000290

....I:*....u@O

Try it online!

Next sequence

80. Mathics, 140 Bytes, A000013

EulerPhi[x_] := Sum[If[CoprimeQ[i,x], 1, 0], {i, 1, x}]
OEIS[x_] := Sum[If[IntegerQ[x/d], (EulerPhi[2d]*2^(x/d))/(2x), 0], {d,1,x}]
OEIS[#]&

Try it Online!

Next Sequence

79. Commentator, 13 bytes, A000012

 */          

Try it online!

Next Sequence

A space increments the accumulator and */ outputs it as a number. As the program has outputted, the spaces at the end are essentially no-ops.

78. anyfix, 12 bytes, A000051

        2«*‘

Try it online!

Next Sequence

Note: TIO says 15 bytes but that's because I haven't asked Dennis to configure Anyfix to use the Jelly codepage yet.

77. Braingolf, 51 bytes, A004147

m32&gM9784&gM7571840&gM11140566368&gMvvcv1+[R<v]v_;

Try it online!

Next sequence

76. Pygmy, 4147 bytes, A000036

globaln: 0                                                                                           

Pi:: 3.141592653589793                                                                               

floor:: (number) {                                                                                   
    floatPart: number % 1                                                                            
    number >= 0 =>                                                                                   
    number - floatPart                                                                               
    number - floatPart - 1                                                                           
}                                                                                                    

fsqrt:: (number) {                                                                                   
    floor| number ^ 0.5                                                                              
}                                                                                                    

summation:: (f i imax) {                                                                             
    i > imax => 0                                                                                    
    (f| i) + summation| f, i + 1, imax                                                               
}                                                                                                    

absoluteValue:: (number) {                                                                           
    number < 0 => -number                                                                            
    number                                                                                           
}                                                                                                    

A:: (number) {                                                                                       
    globaln~: number                                                                                 
    1 + 4 * (fsqrt| number)                                                                          
       + 4 * (fsqrt| number / 2) ^ 2                                                                 
       + 8 * summation| (j){ fsqrt| globaln - j * j }, (fsqrt| number / 2) + 1, (fsqrt| number)      
}                                                                                                    

V:: (number) {                                                                  
    Pi * number                                                                      
}                                                                                    

P:: (number) {                                             
    (A| number) - (V| number)                               
}                                                           

recordMax: 0                                           
findRecord:: (searchIndex record recordCount) {                                    
    x: absoluteValue| P| searchIndex                                               
    (x > record && recordCount = recordMax - 1) => searchIndex                     
    x > record => findRecord| searchIndex + 1, x, recordCount + 1                  
    findRecord| searchIndex + 1, record, recordCount                               
}                                                                                  

A000099:: (number) {                                                                 
    recordMax~: number                                                              
    findRecord| 1, 0, 0                                                              
}                                                                               

A000035:: (number) {                                                                       
    floor| (P| (A000099| number)) + 0.5                                         
}                                                                               

Next Sequence

You can run the code on this page. For example, you can get the 10th number in the sequence by copying the code above and adding:

alert| A000035| 10

75. GolfScript, 36 bytes, A000077

~2\?):P.*,{.P/.*\P%.*6*+}%.&{P<},0-,

Online demo

Next sequence

74. Racket, 77 bytes, A000363

(define(a n)(/(-(expt 5 n)(*(sub1(* 2 n))(expt 3 n))(* 2 n)2(-(* 2 n n)))16))

Try it online!

Next sequence

73. Starry, 363 bytes, A000252

, +      + *     '.     `
 + + + +  *  *  *  +     
 +`      +*       +    ` 
 + +   +  + +   + *  '   
   +   '  ####`  + +   + 
 + +    ####  +*   +    *
    '  #####  +      + ' 
  `    ######+  + +   +  
+ +   + #########   * '  
 +   +  + #####+ +      +
*  +      + * +  *  *   +
   +  *  + + + +  *  *   
+   +  +   *   + `  + +  
 +  + +   + *'    +    +.

Try it online!

Next sequence

Uses the formula "a(n) = n^4 * product p^(-3)(p^2 - 1)*(p - 1) where the product is over all the primes p that divide n" from OEIS.

The moon's a no-op, but hey, this isn't code-golf.

72. SML, 252 bytes, A000401

fun A000401 x =
    let fun helper x y z =
        if z mod 4 = 0 then helper x y (z div 4)
        else if z mod 16 = 14 then helper x (y + 1) (y + 1)
        else if x = 0 then y
        else helper (x - 1) (y + 1) (y + 1)
    in helper x 0 1
    end

Online demo

(Note: those blocks which look like four spaces each are really tabs. I forgot about StackExchange forcing tabs into spaces, and now that I've posted the next sequence it's a bit late to change. If anyone is really fussed then they can be changed to use a single space for indentation).

Next sequence

Dissection

This uses the characterisation given in Dickson's History of the Theory of Numbers:

These are the numbers not of the form 4^k*(16*n + 14)

I could have defined one helper function to test for numbers not in the sequence and another to find the xth number which passes the test, but I think it's more in the spirit of PPCG to use a single helper function with two accumulators. x is the number we still have to discard; y is the number currently under consideration; z is y divided by some power of 4.

There is a small hack in calling it as helper x 0 1: if I called it as helper x 0 0 then there would be an infinite loop because 0 is divisible by 4 yielding 0.

71. F# (Mono), 401 bytes, A001134

That was quite an experience, using a language I've never tried before which is based on a bunch of programming paradigms I've never experienced before...

let isprime p =
  let mutable q = 2
  while q * q < p && p % q > 0 do
    q <- q + 1
  p >= 2 && q * q > p

let isA001134 p =
  let mutable i = 1
  let mutable g = 2
  while g <> 1 do
    g <- g * 2 % p
    i <- i + 1
  i * 4 = p - 1 && isprime p

let A001134 n =
  let mutable q = n
  let mutable result = 113
  while q > 0 do
    result <- result + 4
    if isA001134 result then q <- q - 1
  result

Try it online!

Next sequence

70. Elm, 1134 bytes, A000333

import Html exposing (text)

f n s = let l = takeWhile (\x -> (s + sqrt (toFloat x)) <= n) (List.range 1 (floor (n*n)))
        in List.map (\x -> [x]) l 
        ++ (List.concatMap (\x -> List.map (\y -> x::y) ( f n (s+sqrt (toFloat x)) )) l)

t n = List.length(List.map List.head(group(List.sort(List.map List.sort(f(n+1)0)))))

main = text (toString (List.length (t 5)))


takeWhile : (a -> Bool) -> List a -> List a
takeWhile predicate list =
  case list of
    []      -> []
    x::xs   -> if (predicate x) then x :: takeWhile predicate xs
              else []

dropWhile : (a -> Bool) -> List a -> List a
dropWhile predicate list =
  case list of
    []      -> []
    x::xs   -> if (predicate x) then dropWhile predicate xs
              else list

span : (a -> Bool) -> List a -> (List a, List a)
span p xs = (takeWhile p xs, dropWhile p xs)

groupBy : (a -> a -> Bool) -> List a -> List (List a)
groupBy eq zs =
  case zs of
    [] -> []
    (x::xs) -> let (ys,zs) = span (eq x) xs
              in (x::ys)::groupBy eq zs

group : List a -> List (List a)
group = groupBy (==)

This is much prettier in Haskell, but it has been used.


Try it online!

Next sequence

69. GAP, 333 bytes, A000761

dirs:=[[1,0,0],[0,1,0],[0,0,1]];
dirs:=Concatenation(dirs,-dirs);

count:=function(pos,seen,n)
  local newseen;
  if (pos in seen) or AbsInt(pos[1]-2)>n then
    return 0;
  fi;
  if n=0 then
    return 1;
  fi;
  newseen:=Concatenation(seen,[pos]);
  return Sum(dirs,d->count(pos+d,newseen,n-1));
end;

f:=n->count([0,0,0],[],n+2);

Next sequence

68. Pascal (FPC), 761 bytes, A000837

function Mobius(n: integer): integer;
type
	iarray = array of integer;
var
	result: iarray;
	i, j, sum: integer;
begin
	setlength(result,n+1);
	result[1] := 1;
	for i := 2 to n do
	begin
		sum := 0;
		for j := 1 to i-1 do
			if (i mod j = 0) then
				sum := sum + result[j];
		result[i] := -sum;
	end;
	Mobius := result[n];
end;

function A000837(n: integer): integer;
type
	iarray = array of integer;
var
	partitions: iarray;
	i, j, sum: integer;
begin
	setlength(partitions,n+1);
	partitions[0] := 1;
	for i := 1 to n do
		for j := i to n do
			partitions[j] := partitions[j] + partitions[j-i];
	sum := 0;
	for i := 1 to n do
		if (n mod i = 0) then
			sum := sum + partitions[i] * Mobius(n div i);
	if (n = 0) then
		A000837 := 1
	else
		A000837 := sum;
end;

Try it online!

Next sequence

How it works

It generates the partitions using the trivial gf:

prod(q=[1,infty], 1/(1-x^q))

and then uses the Möbius Transform.

67. LOLCODE, 837 bytes, A000043

HAI 1.2
  CAN HAS STDIO?

  I HAS A CONT ITZ 0
  I HAS A ITRZ ITZ 1
  I HAS A NUMBAH
  GIMMEH NUMBAH
  NUMBAH R SUM OF NUMBAH AN 1

  IM IN YR GF
    ITRZ R SUM OF ITRZ AN 1

    I HAS A PROD ITZ 1
    IM IN YR MOM UPPIN YR ASS WILE DIFFRINT ITRZ AN SMALLR OF ITRZ AN ASS
      PROD R PRODUKT OF PROD AN 2
    IM OUTTA YR MOM
    PROD R DIFF OF PROD AN 1

    I HAS A PRAIME ITZ WIN
    I HAS A VAR ITZ 1
    IM IN YR MOM
      VAR R SUM OF VAR AN 1
      BOTH SAEM VAR AN PROD, O RLY?
        YA RLY, GTFO
      OIC
      BOTH SAEM 0 AN MOD OF PROD AN VAR, O RLY?
        YA RLY
          PRAIME R FAIL
          GTFO
      OIC
    IM OUTTA YR MOM

    BOTH SAEM PRAIME AN WIN, O RLY?
      YA RLY, CONT R SUM OF CONT AN 1
    OIC

    BOTH SAEM NUMBAH AN CONT, O RLY?
      YA RLY, GTFO
    OIC
  IM OUTTA YR GF

  VISIBLE ITRZ
KTHXBYE

My capslock key is bound to escape, so I wrote this entire thing while holding shift ..

Try it online!

Next sequence

56. Pony, 138 bytes, A000041

fun f(n: U64, q: U64 = 1): U64 =>
  if n>0 then
    if n>=q then
      f(n-q, q)+f(n,q+1)
    else
      0
    end
  else
    1
  end //a

Try it online! (Thank you for adding Pony Dennis!)

Next sequence

66. Yacas, 43 bytes, A000371

f(n):=Sum(k,0,n,(-1)^(n-k)*Bin(n,k)*2^2^k);

Try it online!

Next sequence

65. Fortran (GFortran), 371 bytes, A000152

function A000152(n)
	integer :: n, i, a, sum, index, A000152
	integer, dimension(n+1) :: gf
	gf(1) = 1
	do i=2,n+1
		gf(i) = 0
	end do
	do a=1,16
		do i=n+1,2,-1
			sum = 0
			index = 1
			do while (index * index < i)
				sum = sum + 2 * gf(i - index * index)
				index = index + 1
			end do
			gf(i) = gf(i) + sum
		end do
	end do
	A000152 = gf(n+1)
end function A000152

Try it online!

Next sequence

How it works

It uses the following gf:

(sum(m=[-infty,infty], x^(m^2)))^16

64. LiveScript, 152 bytes, A000108

f = (n) ->
  ns = [1]
  for i from 0 to n-1
    ns.push 0
    s = 0
    for k from 0 to ns.length-1
      s += ns[k]
      ns[k] =  s
  ns[ns.length-1]

Try it online!

Next sequence

63. Haxe, 108 bytes, A000057

function(a,n=3){while(a>0){var i=0,x=0,y=1,z;while(y>0&&i++<=n){z=x+y;x=y;y=z%n;}i==n++&&a-->0;}return n-1;}

Test it online!

Next sequence

62. S.I.L.O.S, 57 bytes, A000005

readIO
n=i
lblb
r=n%i
r/r
r=1-r
s+r
i-1
if i b
printInt s

Try it online!

Next Sequence


*LeakyNun asked me to post this, again.

61. √ å ı ¥ ® Ï Ø ¿, 5 bytes, A000007

I0^o 

Next sequence

60. Oasis, 5 + 2 = 7 bytes, A000059

+2 bytes for the N and o flags.

Code:

x4m>p

Try it online!

Explanation:

x      # Double the number
 4m    # Raise to the power of 4
   >   # Add one
    p  # Check for primality

Used with the following flags:

Next sequence

59. Brachylog, 59 bytes, A000011

;2↔^gP~g⟦k;Pz+ᵐḃᵐbᵐ{↔;?T{{;1↔-}ᵐ}ᵐ,T{{~cĊ↔c}ᶠb}ᵐ{∋∋}ᶠo}ᵐ∋ᶜ¹

Try it online!

Next sequence

58. 2sable, 11 bytes, A000119

<DÅFÙïæOrQO

Try it online!

<DÅFÙïæOrQO  Program
<            Decrement for 0-indexing
 D           Duplicate top of stack (for later use)
  ÅF         List of fibonacci numbers up to the current number
    Ù        Remove duplicates
     ï       Convert each element to an integer (they become strings for whatever reason ;_;)
      æ      Powerset
       O     Sum of each subset in the powerset
        r    Reverse stack (I don't think this is necessary, but 10 bytes isn't allowed anyway)
         Q   Equality check; vectorizes
          O  Gives number of occurrences; done

Next Sequence

21. M, 24 bytes, A000015

Ṫ*Ḣ
l2Rp²ÆR$µÇ€<³$ÐḟṂ
‘Ç

Try it online!

Next Sequence

Sorry for changing the next sequence; I had to fix my indexing.

Explanation

Ṫ*Ḣ                !!!!!!! Helper Link
Ṫ                  Last element
 *                 To the power of
  Ḣ                First element
l2Rp²ÆR$µÇ€<³$ÐḟṂ  !!!!!!! Main Link
l2R                Range up to log_2(input); this is the largest power we need to handle because 2**k will be at least `input` this way
   p               Cartesian Product with
    ²ÆR$           All primes up to `input squared`
        µ          New Monadic Link
         ǀ        Call the last link on each element (all prime powers)
              Ðḟ   Filter to discard
           <³$                       elements smaller than the input
                Ṃ  Minimum Value
‘Ç                 !!!!!!! Called Link
‘                  Decrement
 Ç                 Call the Main Link

57. Desmos, 119 bytes, A000138

f\left(n\right)=n!\sum _{i=0}^{\operatorname{floor}\left(\frac{n}{4}\right)}\frac{\left(-1\right)^i}{i!\cdot 4^I}

Try It Online!

Next Sequence

55. ><>, 41 bytes, A000196

:1>::*$@(?vv
  ^ +1@@:$ <
          \1-n;

Try it online!

Next sequence

54. C# (.NET Core), 196 bytes, A000034

using System;
namespace A000008
{
    class Program
    {
        static void Main(string[] args)
        {
           Console.WriteLine(1 + Int32.Parse(Console.ReadLine()) % 2);
        }
    }
}

Try it online!

Next Sequence

53. Coffeescript, 34 bytes, A000484

alert Math.round Math.cos prompt()

Try it online!

Next sequence

52. Ceylon, 484 bytes, A000008

Integer f(Integer n) {
	variable Integer coin1 = 0;
	variable Integer coin2 = 0;
	variable Integer coin5 = 0;
	variable Integer coinT = 0;
	variable Integer count = 0;
	while (coin1 <= n) {
		while (coin2 <= n / 2) {
			while (coin5 <= n / 5) {
				while (coinT <= n / 10) {
					if (n == coin1 + 2 * coin2 + 5 * coin5 + 10 * coinT) {
						count++;
					}
					coinT++;
				}
				coin5++;
				coinT = 0;
			}
			coin2++;
			coin5 = 0;
		}
		coin1++;
		coin2 = 0;
	}
	return count; 
}

Try it online!

huehue I'm a Ceylon noob

Next Sequence (c'mon this is so easy)

50. Japt, 26 bytes, A000074

1o2pU 2 èÈo f_¬v1Ãd_nX ¬v1

Try it online!

Next sequence (I was quite tempted to ungolf it by 1 byte to get A000027, but this one should be fine)

Explanation

1o2pU 2 èÈ  o f_  ¬ v1à d_  nX ¬ v1
1o2pU 2 èX{Xo fZ{Zq v1} dZ{ZnX q v1}}   Ungolfed
                                        Implicit: U = input integer
  2pU                                   Yield 2 ** U.
1o    2                                 Create the range [1, 3, 5, ..., 2**U - 1].
        èX{                         }   Find the number of items X where this is true:
           Xo                             [0, 1, ..., X - 1]
              fZ{     }                   filtered to only items Z where
                 Zq v1                      sqrt(Z) is divisible by 1 (Z is square)
                                          (this gives a list of the squares less than X)
                        dZ{        }      contains an item Z where
                           ZnX              X - Z
                               q v1         is also square.
                                          In other words, assert that an integer solution
                                          to X = a**2 + b**2 exists.
                                        This gives the number of odd integers less than 2**U
                                        that can be represented as the sum of two squares.
                                        Implicit: output result of last expression

51. Burlesque, 8 bytes, A000026

fCf:FLpd

Try it online!

Next sequence

47. awk, 194 bytes, A000021

{
 n=0;
 for (i=1; i<=2**$1; i++) {
  stop = 0;
  for (x=0; x<=i && !stop; x++) {
   for (y=0; y<=i && !stop; y++) {
    if (x**2 + 12*y**2 == i){
     n++; stop=1;
    }
   }
  }
 }
 print n;
}

Try it online!

Next sequence

49. SageMath, 74 bytes, A000003

lambda n: len(BinaryQF_reduced_representatives(-4*n, primitive_only=True))

Try it online!

Next sequence

48. SOGL, 3 bytes, A000194

.√Ρ

Next sequence

46. Jellyfish, 21 bytes, A000190

p
d^0
1|&*&*r
 E    i

Try it online!

Next sequence

45. D, 190 bytes, A000094

int A000094(int n) {
	if (n<4) {
		return 0;
	}
	int[] gf = new int[n+1];
	gf[0] = 1;
	for (int i=1; i<n; i++) {
		for (int j=i; j<=n; j++) {
			gf[j] += gf[j-i];
		}
	}
	return gf[n]-n+1;
}

Try it online!

Next sequence

44. Maxima, 94 bytes, A000651

f(n):=sum((2*k)!/k!/(k+1)!,k,1,n)+sum((2*binomial(n+k-1,k)-binomial(n+k,k))*f(n-1-k),k,0,n-2);

Try it online!

Next sequence

42. Cheddar, 28 bytes, A000503

n->(tan(n)|0)-(tan(n)<0?1:0)

Try it online!

Next sequence

41. PHP, 503 bytes, A003416

function f ($n) {
  $i=12495; $cnt=0; $used =[];

  while (true) {
    $i++;
    $ns = [];
    $v = $i;
    $sm = $i;

    while (!in_array($v, $ns)) {
      $ns[] = $v;
      $s = 0;

      for ($k=1; $k<=$v/2; $k++)
        if ($v % $k == 0) $s += $k;

      $v = $s;
      if ($s == 1) break;
      $sm = min($sm, $v);
    }

    if ($v < 2) continue;
    if (in_array($sm, $used)) continue;
    if ($cnt == $n) return $sm;
    $cnt++;

    for ($i=0; $i < count($ns); $i++) $used[] = $ns[$i];
  }
}

Try it online!

Next sequence

39. Add++, 1 byte, A000004

O

Try it online!

Next sequence

38. Actually, 4 bytes, A000006

P√LA

Try it online!

Next sequence

37. 05AB1E, 6 bytes, A000124

The courtesy of Leaky Nun.

D>*2÷>

Try it online!

Next Sequence

36. J, 124 bytes, A000067

squares =: *:@i.@>:@<.@%:
filter =: ] #~ [ >: ]
f =: [: <: (2^]) +/@:>: [: ~.@,/ (2^<:@]) (] +/ 2 * filter) [: squares (2^])

Try it online!

Next sequence

35. dc, 67 bytes, A000168

?sw[1[li*li1-dsi0<o]soli0<o]se3lw^2*lw2*silex*lwsilexlw2+silex*/p0P

Try it online!

Next Sequence

34. Prolog (SWI), 168 bytes, A000073

tribonacci(0,0).
tribonacci(1,0).
tribonacci(2,1).
tribonacci(A,B):-
	C is A-1,
	D is A-2,
	E is A-3,
	tribonacci(C,F),
	tribonacci(D,G),
	tribonacci(E,H),
	B is F+G+H.

Try it online!

Next sequence

33. Octave, 73 bytes, A000216

function o=s(x)
if x<2
o=2;
else
o=sum((int2str(s(x-1))-'0').^2);
end
end

Try it online!

Pretty basic recursive formula.

Next sequence

31. Joy, 172 bytes, A001112

DEFINE acf == [20 <] [[0 1 1 3 4 11 136 283 419 1121 1540 38081 39621 117323 156944 431211 5331476 11094163 16425639 43945441] of] [10 - dup 10 -] [[39202 *] dip -] binrec.

Try it online!

Next sequence

32. C (gcc), 216 bytes, A000172

#include <stdio.h>

#define cube(x) (x)*(x)*(x)

int main(int a) {
	int n;
	scanf("%d",&n);
	int nCr = 1;
	int sum = 0;
	for(int r=0;r<=n;r++) {
		sum += cube(nCr);
		nCr *= n-r;
		nCr /= r+1;
	}
	printf("%d",sum);
}

Try it online!

Next sequence

30. Python 1, 1112 bytes, A000046

def rotations(array):
	rotations = []
	for divider_index in range(len(array)):
		rotations.append(array[divider_index:] + array[:divider_index])
	return rotations

def next(array):
	for index in range(len(array) - 1, -1, -1):
		array[index] = 1 - array[index]
		if array[index]: break
	return array

def reverse(array):
	reversed = []
	for index in range(len(array) - 1, -1, -1):
		reversed.append(array[index])
	return reversed

def primitive(array):
	for index in range(1, len(array)):
		if array == array[:index] * (len(array) / index): return 1
	return 0

def necklaces(size):
	previous_necklaces = []
	array = [0] * size
	necklaces = 0
	for iteration in range(2 ** size):
		if not primitive(array) and array not in previous_necklaces:
			necklaces = necklaces + 1
			for rotation in rotations(array):
				complement = []
				for element in rotation:
					complement.append(1 - element)
				previous_necklaces.append(rotation)
				previous_necklaces.append(complement)
				previous_necklaces.append(reverse(rotation))
				previous_necklaces.append(reverse(complement))
		array = next(array)
	return necklaces

Try it online!

Not even going to bother to golf this. Hey, it's not my longest Python answer on this site!

Next sequence

29. JavaScript (SpiderMonkey), 46 bytes, A000009

f = function(n,q=1)n?n<q?0:f(n-q,q)+f(n,q+2):1

Try it online! The OEIS page is rather daunting, but after reading it for a while I realized that this boils down to the partitions problem, but using only odd integers. Change the q+2 to q+1 and you have a function that calculates the number of partitions of a number.

Next sequence. I tried hard to leave it off on an easy one, I really did...

28. Positron, 9 bytes, A000584

->{$1**5}

Try it online!

Finally got Positron in here ^_^

Next sequence

27. C++, 584 bytes, A000274

#include <map>
#include <functional>
using namespace std;
int f(int i) {
    map<int, int> m;
    function<int(int)> a = [&](int j){
        if (!m.count(j)) {
            switch (j) {
            case -1:
            case 0:
                m[j] = 0;
                break;
            case 1:
                m[j] = 1;
                break;
            case 2:
                m[j] = 3;
                break;
            default:
                m[j] = (1+j)*a(j-1)+(3+j)*a(j-2)+(3-j)*a(j-3)+(2-j)*a(j-4);
            }
        }
        return m[j];
    };
    return a(i - 1);
}

Recursive solution with caching.

Next Sequence (shouldn't be a tricky one)

26. TI-BASIC, 274 bytes, A000183

.5(1+√(5→θ
"int(.5+θ^X/√(5→Y₁
"2+Y₁(X-1)+Y₁(X+1→Y₂
{0,0,0,1,2,20→L₁
Prompt A
Lbl A
If A≤dim(L₁
Then
Disp L₁(A
Else
1+dim(L₁
(~1)^Ans(4Ans+Y₂(Ans))+(Ans/(Ans-1))((Ans+1))-(2Ans/(Ans-2))((Ans-3)L₁(Ans-2)+(~1)^AnsY₂(Ans-2))+(Ans/(Ans-3))((Ans-5)L₁(Ans-3)+2(~1)^(Ans-1)Y₂(Ans-3))+(Ans/(Ans-4))(L₁(Ans-4)+(~1)^(Ans-1)Y₂(Ans-4→L₁(Ans
Goto A
End

Evaluates the recursive formula found on the OEIS link.

Next Sequence

25. eta, 183 bytes, A000033

f x = sum $ map f [2..n]
  where f k = g k `div` h k
        g k = (-1)^k * n * v (2*n-k-1) * v (n-k)
        h k = v (2*n-2*k) * v (k-2)
        v n = product [1..n]
        n = x+1

Try it online

Next sequence

24. Julia 0.5, 33 bytes, A000023

Expansion of e.g.f. exp(−2*x)/(1−x).

!x=foldl((a,b)->a*b+(-2)^b,1,1:x)

Try it online!

Next sequence.

23. Ruby, 23 bytes, A000982

a=->(n){(n*n/2.0).ceil}

Try it online!

Next sequence

23rd entry uses 23 bytes!

20. cQuents, 15 bytes, A000045

$0=0,1:z+y)))))

$0 means 0-indexed, =0,1 means it starts with 0,1, : means if given n it returns the nth item in the sequence, z+y means each item is the previous two added together. ))))) are no-ops due mostly to interpreter bugs.

Try it online!

Next sequence

19. Curry, 45 bytes, A000037

f n=[x|x<-[1..],notElem x [y*y|y<-[1..x]]]!!n

Try it online

Next sequence

18. APL (Dyalog), 37 bytes, A000018

{+/(1↓∪,∘.{(⍵×⍵)+16×⍺×⍺}⍨⍳1+2*⍵)≤2*⍵}

Try it online!

Next sequence

Warning: this is terribly inefficent

17. Stacked, 18 bytes, A000069

[bits  sum odd]nth

Try it online!

Next sequence. Pretty simple. Computes the number of bits, calculates the sum, then checks for odd parity. Then takes the nth such number. Hehehe good luck.

In retrospect, I could have made it 16 bytes instead of 17 or 18:

[bits sum 2%]nth

But oh well

16. Lua, 69 bytes, A000085

function f(n)
 if n<2 then return 1 end
 return f(n-1)+~-n*f(n-2)
end

Try it online!

Next sequence

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 *= (n + k) / k
        Next
        Return ans
    End Function
    Shared Function Answer(n As Long) As Long

        n += 7

        Dim a As Long = Catalan(n - 2)

        Dim b As Long = Catalan(n / 2 - 1)
        If n Mod 2 = 0 Then
            b = Catalan(n / 2 - 1)
        Else
            b = 0
        End If

        Dim c As Long = Catalan(n \ 2 - 1) ' integer division (floor)

        Dim d As Long
        If n Mod 3 = 0 Then
            d = Catalan(n / 3 - 1)
        Else
            d = 0
        End If

        Dim e As Long = Catalan(n / 4 - 1)
        If n Mod 4 = 0 Then
            e = Catalan(n / 4 - 1)
        Else
            e = 0
        End If

        Dim f As Long = Catalan(n / 6 - 1)
        If n Mod 6 = 0 Then
            f = Catalan(n / 6 - 1)
        Else
            f = 0
        End If

        Return (
                    a -
                    (n / 2) * b -
                    n * c -
                    (n / 3) * d +
                    n * e +
                    n * f
                ) /
                (2 * n)
    End Function
End Class

A001246

Try it Online!

14. Python 2, 60 bytes, A001246

f=lambda x:x<1or x*f(x-1)
c=lambda n:(f(2*n)/f(n)/f(n+1))**2

Try it online!

Next sequence.

10. Magma, 65 bytes, A000019

f:=function(n);return NumberOfPrimitiveGroups(n+1);end function;

Try it here

lol builtin

Next sequence

9. Pyth, 19 bytes, A000025

?>Q0sm@_B1-edld./Q1

Test suite.

Next sequence

a(n) = number of partitions of n with even rank minus number with odd rank. The rank of a partition is its largest part minus the number of parts.

4. Jelly, 2 bytes, A000038

ṆḤ

Try it online!

Next Sequence

5. Python 3, 72 bytes, A000002

n=int(input())
l=[1,2,2]
for i in range(2,n):l+=[1+i%2]*l[i]
print(l[n])

Try it online!

Next Sequence

7. Brain-Flak, 70 bytes, A000071

({}[<>((()))<>]){({}[()])<>({}<>)<>(({})<>({}<>))<>}<>{}{}({}<>{}[()])

Try it online!

Next sequence

Explanation

({}[<>((()))<>]) #{ place a one on the off stack and subtract 1 from the input (to zero index)}
                {({}[()])                          } #{n times}
                         <>({}<>)<>(({})<>({}<>))<>  #{Add the top two numbers in place}
                                                    <>{}{}({}<>{}[()]) #{Clean up and subtract 1}

6. R, 71 bytes, A000072

function(n)length(unique((t<-outer(r<-(0:2^n)^2,r*4,"+"))[t<=2^n&t>0]))

Try it online!

Next sequence

8. Mathematica (10.1), 25 bytes, A000070

Tr@PartitionsP@Range@#+1&

Next sequence

3. JavaScript (ES6), 38 bytes, A000044

f=n=>n<0?0:n<3?1:f(n-1)+f(n-2)-f(n-13)

Try it online!

Next sequence (should be an easy one :P)

2. Haskell, 44 bytes, A000010

f k|n<-k+1=length.filter(==1)$gcd n<$>[1..n]

Try it online!

Next Sequence