Module:Sequence

From Xenharmonic Wiki
Jump to navigation Jump to search

Documentation transcluded from /doc
Icon-Todo.png Todo: Documentation

local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.contains(seq, n)
	if n > seq[#seq] then
		return nil
	end
	for i = 1, #seq do
		if seq[i] == n then
			return true
		end
	end
	return false
end

function p.get_term(frame)
	local args = getArgs(frame)
	return p._get_term(args[1], tonumber (args[2]))
end

function p._get_term(seq, n)
	local sequences = {
		["odd_limit_diff"] = p.odd_limit_diff,
		["zeta_peak"] = p.zeta_peak,
		["zeta_integral"] = p.zeta_integral,
		["zeta_gap"] = p.zeta_gap,
		["square_superparticulars"] = p.square_superparticulars
	}
	return sequences[seq][n]
end

-- OEIS A072451
-- Number of odd terms in the reduced residue system of 2*n-1
-- Corresponds to the number of new interval pairs between the (2n-3)-odd-limit
-- and the (2n-1)-odd-limit, assuming the 1-odd-limit has 1 "pair" of intervals.
p.odd_limit_diff = {
	1, 1, 2, 3, 3, 5, 6, 4, 8, 9,
	6, 11, 10, 9, 14, 15, 10, 12, 18, 12,
	20, 21, 12, 23, 21, 16, 26, 20, 18, 29,
	30, 18, 24, 33, 22, 35, 36, 20, 30, 39,
	27, 41, 32, 28, 44, 36, 30, 36, 48, 30,
	50, 51, 24, 53, 54, 36, 56, 44, 36, 48,
	55, 40, 50, 63, 42, 65, 54, 36, 68, 69,
	46, 60, 56
}

-- OEIS A117536
p.zeta_peak = {
	0, 1, 2, 3, 4, 5, 7,
	10, 12, 19, 22, 27, 31, 41, 53, 72, 99,
	118, 130, 152, 171, 217, 224, 270, 342, 422, 441, 494, 742, 764, 935, 954,
	1012, 1106, 1178, 1236, 1395, 1448, 1578, 2460, 2684, 3395, 5585, 6079, 7033, 8269, 8539,
	11664, 14348, 16808, 28742, 34691,
	-- unconfirmed data from [[The Riemann zeta function and tuning #Zeta EDO lists]]
	36269, 57578, 58973, 95524,
	102557, 112985, 148418, 212147, 241200
}

p.zeta_peak_integer = {
	0, 1, 2, 3, 5, 7, 
	10, 12, 19, 22, 31, 41, 53, 87, 
	118, 130, 171, 224, 270, 311, 472, 494, 742, 
	1065, 1106, 1395, 1578, 2460, 2684, 3566, 4231, 4973, 5585, 8269, 8539, 
	14124, 14348, 16808, 28742, 30631, 34691, 36269, 57578, 58973
}

-- OEIS A117538
p.zeta_integral = {
	2, 5, 7,
	12, 19, 31, 41, 53, 72,
	130, 171, 224, 270, 764, 954,
	1178, 1395, 1578, 2684, 3395, 7033, 8269, 8539,
	14348, 16808, 36269, 58973
}

-- OEIS A117537
p.zeta_gap = {
	2, 3, 5, 7,
	12, 19, 31, 46, 53, 72,
	270, 311, 954,
	1178, 1308, 1395, 1578, 3395, 4190,
	-- unconfirmed data from [[The Riemann zeta function and tuning#Zeta EDO lists]]
	8539,
	14348, 58973, 95524
}

-- square superparticular indices by prime limit
-- counted by OEIS A117582
-- see https://github.com/lucasaugustus/oeis/blob/main/stormer.py
p.square_superparticulars = {
	[2] = {},
	[3] = {2, 3},
	[5] = {4, 5, 9},
	[7] = {6, 7, 8, 15, 49},
	[11] = {10, 11, 21, 55, 99},
	[13] = {
		12, 13, 14, 25, 26, 27, 64, 65,
		351
	},
	[17] = {
		16, 17, 33, 34, 35, 50, 51,
		120, 169, 441
	},
	[19] = {
		18, 19, 20, 39, 56, 76, 77,
		153, 170, 209, 324,
		2431
	},
	[23] = {
		22, 23, 24, 45, 69, 91,
		161, 208, 323, 391,
		2024
	},
	[29] = {
		28, 29, 57,
		115, 116, 144, 175, 231, 289, 494, 551, 783,
		1275, 2001, 3249, 9801,
		13311
	},
	[31] = {
		30, 31, 32, 63, 92,
		125, 154, 155, 341, 342, 495, 528, 714,
		1519, 1520,
		13455
	},
	[37] = {
		36, 37, 38, 75,
		111, 185, 186, 221, 260, 406, 407, 666, 703, 961,
		1000, 1331, 1444, 1665, 1701, 2737, 3626, 5291, 7105,
		17576
	},
	[41] = {
		40, 41, 81,
		124, 204, 246, 247, 286, 287, 288, 369, 493, 575,
		1024, 1025, 1189, 1518, 1681, 1682, 1886, 2295, 3773, 4960, 5083,
		29601, 32799,
		212381
	},
	[43] = {
		42, 43, 44, 85, 86, 87,
		129, 171, 216, 259, 300, 343, 344, 559, 560, 645, 989,
		1332, 1333, 1376, 1805, 1849, 2107, 2108, 2665, 2925, 4256, 4901, 5290,
		10879, 10880, 11439,
		134849
	},
	[47] = {
		46, 47, 48, 93, 94, 95,
		187, 188, 189, 329, 375, 376, 377, 517, 704, 799, 846, 987, 988,
		1035, 1364, 1457, 1599, 2209, 2255, 2584, 4465, 6579, 7568,
		16169, 17577, 19551, 21385,
		192511
	},
	[53] = {
		52, 53, 54,
		105, 160, 265, 319, 370, 371, 424, 476, 529, 637, 689, 741, 847, 900, 901, 902,
		1377, 2015, 2755, 2915, 5831, 11661, 1749, 4929, 6149,
		23001, 23374, 27455, 36518, 62699,
		247456, 248676,
		1205645
	},
	[59] = {
		58, 59,
		117, 118, 119, 176, 235, 295, 296, 530, 531, 532, 589, 649, 650, 944, 945,
		1121, 1887, 2184, 2300, 2419, 3009, 3363, 5075, 5781, 6137, 6727, 6784, 6785, 7315, 8555,
		10620, 13689, 17051, 19942, 27435, 31212, 37583, 46138, 55224, 63426,
		956449
	},
	[61] = {
		60, 61, 62,
		121, 122, 123, 183, 184, 243, 244, 245, 305, 550, 609, 610, 611,
		1036, 1160, 1219, 1220, 1221, 1463, 1768, 1769, 1770, 1891, 2014, 2256, 2379, 2500, 2623, 2624, 5247, 5734, 5796, 8601,
		11285, 14336, 16225, 18240, 22815, 74359, 88451,
		102601, 113399, 147499, 302499
	},
	[67] = {
		66, 67, 68,
		133, 134, 135,
		469, 671, 736, 737, 805,
		1072, 1272, 1273, 1274, 1407, 1475, 1540, 2145, 2210, 2278, 2279, 2479, 3484, 3552, 3751, 3886, 3887, 4557, 4624, 4959, 5829, 5830, 7503, 7905,
		17689, 18491, 19228, 20769, 25193, 26196, 27000, 31959, 41876, 43616, 44891, 45695, 48374, 50653, 98021,
		187265, 314432,
		2018979
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[71] = {
		70, 71,
		141, 142, 143, 285, 425, 426, 496, 638, 639, 780, 781, 782, 851, 924,
		1065, 1420, 1633, 2058, 3267, 3478, 3479, 3480, 3550, 3551, 3905, 4047, 4757, 4900, 7525, 8449,
		10934, 11501, 16400, 26129, 26979, 30316, 39689, 52326,
		164151, 180481, 996557,
		1608575, 2456245, 3939649
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[73] = {
		72, 73, 74,
		145, 146, 147, 220, 364, 365, 511, 512, 584, 657, 729, 730, 731, 804, 875,
		1023, 1240, 1241, 1680, 2116, 2262, 2773, 2774, 3212, 3431, 4088, 4599, 5184, 5329, 5475, 5547, 5985, 8177,
		10659, 12921, 17081, 19344, 21608, 22631, 31536, 31900, 35259, 35990, 37961, 39711, 43215, 46575, 48545, 70225, 70226,
		101761, 196882, 271999, 393471, 415151, 787815,
		1215449, 2307019
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[79] = {
		78, 79, 80,
		159, 236, 237, 473, 474, 475, 552, 868, 869, 870, 949,
		1026, 1105, 1106, 1184, 1343, 1421, 1739, 1975, 2211, 2449, 2450, 2924, 3081, 3477, 3870, 3871, 4029, 4186, 4346, 4899, 5292, 5452, 6479, 7425, 7504, 8215, 8295, 9164,
		10585, 11375, 12167, 13431, 14535, 16353, 17458, 29784, 33496, 35075, 46137, 46530, 70151, 70152, 75999, 79236,
		118580, 122451, 146072, 163371, 209509, 525825,
		3607297, 4409069,
		15473809
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[83] = {
		82, 83, 84,
		165, 248, 249, 414, 415, 497, 664, 665,
		1079, 1080, 1161, 1495, 1825, 1826, 2241, 2408, 2738, 2821, 2989, 3403, 3485, 4233, 4234, 4731, 4897, 4898, 5395, 5643, 6391, 6889, 7138, 7139, 8216,
		10044, 10126, 10374, 10625, 12615, 12616, 13114, 15105, 15687, 18425, 20501, 23903, 28304, 36519, 50049, 51128, 53534, 67229, 68475, 79764, 83249, 95201, 97525, 97526, 98686,
		114375, 144585, 154629, 171395, 218041, 275561, 318719, 336896, 830415,
		1572351, 3100215, 6571774, 7534241
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[89] = {
		88, 89, 90,
		177, 266, 267, 355, 356, 533, 624, 711, 712, 713, 800,
		1156, 1246, 1247, 1334, 1425, 1691, 2047, 2491, 2848, 2849, 3025, 3381, 3649, 4095, 4806, 4896, 5074, 5428, 5695, 6231, 6319, 6320, 6497, 7030, 7743, 8722,
		10324, 10857, 12993, 15129, 15841, 18424, 19313, 23851, 24564, 28125, 28303, 29280, 29281, 29547, 35155, 46904, 56870, 68264, 71021,
		110449, 116144, 153791, 193843, 204611, 211641, 250001, 257299, 422304, 695267,
		1270565, 1313641, 3999216, 6167344,
		407498959
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[97] = {
		96, 97, 98,
		195, 290, 291, 484, 485, 581, 582, 583, 775, 776, 874, 969,
		1066, 1067, 1456, 1551, 2133, 2134, 2135, 2232, 2813, 2911, 3008, 3783, 3976, 3977, 4558, 4559, 5625, 5916, 6498, 6499, 6888, 7371, 7565, 7566, 7567, 7955, 8051,
		10864, 13775, 13870, 13871, 14161, 14840, 16684, 17459, 25025, 28519, 37926, 40256, 46656, 57133, 62952, 88560,
		101269, 103500, 113296, 117078, 126294, 129108, 139195, 224847, 313600, 329121, 431649, 442224, 447849, 908600,
		1055361, 1231803, 1555008, 1584010, 7496644,
		43184401
	},
	-- using abc conjecture c < 100 * rad(abc)^2; may be incomplete
	[101] = {
		100, 101, 201, 202, 203, 304, 403, 404, 405, 505, 506,
		1312, 1313, 1616, 1716, 2323, 2324, 2625, 2626, 2627, 2727, 3233, 3535, 4544, 5251, 5453, 6060, 6161, 6364, 6665, 6969, 7372, 7474, 7475, 8281, 8585, 8788, 8990, 9797,
		10200, 12121, 12221, 12321, 12727, 13432, 16059, 17169, 17575, 20502, 21412, 21413, 21715, 44239, 61104, 61711, 75951, 80801, 83425, 84133, 84134, 89889, 92415, 94536,
		100595, 116654, 117363, 133825, 135642, 153217, 161601, 162811, 197456, 255529, 376831, 397536, 485001, 614384,
		2383095, 3444301, 5964959, 6530356, 9814169,
		14455826,
		116026274
	},
}

return p