跳转到内容

模組:Number/data

本页使用了标题或全文手工转换
被永久保护的模块
维基百科,自由的百科全书

local p = { PrimeTable = {} }
local templateParameters = {}
p.numberFormat = {
	['質數']={name="質數",page="素数",info="*{{{orderstr}}}{{{property}}}。",example=13,
		check=function(data) return data.is_prime and data.number > 1 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.last = data.last_p
			result.next = data.next_p
			if p.PrimeTable.table_max == nil then p.PrimeTable = require('Module:Factorization') end
			if p.PrimeTable.lists[data.number] ~= nil then result.order=p.PrimeTable.lists[data.number] end
			return result
		end,
	},
	['孿生質數']={name="孿生質數",page="孪生素数",info="**{{{property}}},為{{{value}}}。",example=13,
		arg_desc={value="該對孿生質數實際上的值"},
		check=function(data) 
			local next_num = (data.next_p or data.number) - data.number
			local last_num = data.number - (data.last_p or data.number)
			return ((next_num == 2 or next_num == 1 and (data.next_p or data.number) ~= data.number) or
					(last_num == 2 or last_num == 1 and ((data.last_p or data.number) ~= data.number)))
					 and data.number > 1
		end,
		value=function(data, otherdata)
			local result = otherdata or {}
			body = ''
			local is_printted = false
			local next_num = (data.next_p or data.number) - data.number
			local last_num = data.number - (data.last_p or data.number)
			if next_num == 2 or next_num == 1 then
				is_printted = true
				body = body .. '(' .. data.number ..'、 [[' .. data.next_p ..']])'
			end
			if last_num == 2 or last_num == 1 then
				if is_printted == true then body = body .. '以及' end
				body = body .. '([[' .. data.last_p ..']]、 ' .. data.number ..')'
			end
			if body and mw.text.trim(body) ~= '' then result.value = body end
			return result
		end,
	},
	['高斯質數']={name="高斯質數",page="高斯整數#作为唯一分解整环",info="**{{{property}}}之一。",example=11,
		check=function(data) return data.is_prime and data.number > 2 and p._is_integer((data.number - 3.0) / 4.0) end,
	},
	['自然數']={name="自然數",page="自然数",info="{{{number}}}是一個{{{property}}},位於{{{last}}}和{{{next}}}之間。",example=28,
		check=function(data) return data.number > 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			if data.number - 1 > 0 then result.last = data.number - 1 end
			result.next = data.number + 1
			return result
		end,
	},
	['整數']={name="整数",page="整數",info="{{{number}}}是一個{{{property}}},位於{{{last}}}和{{{next}}}之間。",example=-28,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.last = data.number - 1
			result.next = data.number + 1
			return result
		end,
	},
	['負數']={name="負數",page="负数",info="*{{{property}}}。",example=-1,
		check=function(data) return data.number < 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.last = data.number - 1
			if data.number + 1 < 0 then result.next = data.number + 1 end
			return result
		end,
	},
	['合數']={name="合數",page="合数",info="*{{{orderstr}}}{{{property}}},[[因數|正因數]]有{{{value}}}{{{releatedstr}}}。",example=28,
		arg_desc={value="正數為所有正因數,負數為所有因數",value2="因數的數量"},
		check=function(data) return data.number > 2 and (not data.is_prime) end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value = table.concat( data.divdata, '、', 1, #(data.divdata) - 1 ) ..'和' .. tostring(data.divdata[#(data.divdata)])
			result.value2 = #(data.divdata)
			return result
		end,
		--https://oeis.org/A002808
		list={[4]=1,[6]=2,[8]=3,[9]=4,[10]=5,[12]=6,[14]=7,[15]=8,[16]=9,[18]=10,
			[20]=11,[21]=12,[22]=13,[24]=14,[25]=15,[26]=16,[27]=17,[28]=18,[30]=19,[32]=20,
			[33]=21,[34]=22,[35]=23,[36]=24,[38]=25,[39]=26,[40]=27,[42]=28,[44]=29,[45]=30,
			[46]=31,[48]=32,[49]=33,[50]=34,[51]=35,[52]=36,[54]=37,[55]=38,[56]=39,[57]=40,
			[58]=41,[60]=42,[62]=43,[63]=44,[64]=45,[65]=46,[66]=47,[68]=48,[69]=49,[70]=50,
			[72]=51,[74]=52,[75]=53,[76]=54,[77]=55,[78]=56,[80]=57,[81]=58,[82]=59,[84]=60,
			[85]=61,[86]=62,[87]=63,[88]=64,[90]=65,[91]=66,[92]=67,[93]=68,[94]=69,[95]=70,
			[96]=71,[98]=72,[99]=73,[100]=74,[102]=75,[104]=76,[105]=77,[106]=78,[108]=79,[110]=80,
			[111]=81,[112]=82,[114]=83,[115]=84,[116]=85,[117]=86,[118]=87,[119]=88,[120]=89,[121]=90,
			[122]=91,[123]=92,[124]=93,[125]=94,[126]=95,[128]=96,[129]=97,[130]=98,[132]=99,[133]=100}
	},
	['質因數分解']={name="質因數分解",page="整数分解",info="*:{{{property}}}為{{{value}}}。",example=28,
		arg_desc={value="質因數分解的結果"},
		check=function(data) return data.number ~= 0 and (not data.is_prime) end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value = data.factors_str
			return result
		end
	},
	['高斯整數分解']={name="高斯整數分解",page="高斯整數#作为唯一分解整环",info="*:其[[第一象限]]之[[高斯整數#作为唯一分解整环|高斯質數]]的[[整数分解]]為{{{value}}}。",example=2,
		arg_desc={value="高斯整數分解的結果"},
		check=function(data) return data.number ~= 0 and (not data.is_gprime) end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value = data.gfactors_str
			return result
		end
	},
	['虧數']={name="虧數",page="亏数",info="*{{{orderstr}}}{{{property}}},[[真因數和]]為{{{value1}}},虧度為{{{value2}}}{{{releatedstr}}}。",example=27,
		arg_desc={value1="真因數和",value2="虧度,即數字與真因數和的差"},
		check=function(data) return data.div_sum < data.number and data.number > 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value1 = data.div_sum
			result.value2 = data.number-data.div_sum
			return result
		end,
		--https://oeis.org/A005100
		list={[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,[7]=6,[8]=7,[9]=8,[10]=9,[11]=10,
			[13]=11,[14]=12,[15]=13,[16]=14,[17]=15,[19]=16,[21]=17,[22]=18,[23]=19,[25]=20,
			[26]=21,[27]=22,[29]=23,[31]=24,[32]=25,[33]=26,[34]=27,[35]=28,[37]=29,[38]=30,
			[39]=31,[41]=32,[43]=33,[44]=34,[45]=35,[46]=36,[47]=37,[49]=38,[50]=39,[51]=40,
			[52]=41,[53]=42,[55]=43,[57]=44,[58]=45,[59]=46,[61]=47,[62]=48,[63]=49,[64]=50,
			[65]=51,[67]=52,[68]=53,[69]=54,[71]=55,[73]=56,[74]=57,[75]=58,[76]=59,[77]=60,
			[79]=61,[81]=62,[82]=63,[83]=64,[85]=65,[86]=66,[87]=67,[89]=68,[91]=69,[92]=70,
			[93]=71,[94]=72,[95]=73,[97]=74,[98]=75,[99]=76,[101]=77,[103]=78,[105]=79,[106]=80,
			[107]=81,[109]=82,[110]=83,[111]=84,[113]=85,[115]=86,[116]=87,[117]=88,[118]=89,[119]=90,
			[121]=91,[122]=92,[123]=93,[124]=94,[125]=95,[127]=96,[128]=97,[129]=98,[130]=99,[131]=100}
	},
	['過剩數']={name="過剩數",page="过剩数",info="*{{{orderstr}}}{{{property}}},[[真因數和]]為{{{value1}}},盈度為{{{value2}}}{{{releatedstr}}}。",example=24,
		arg_desc={value1="真因數和",value2="盈度,即真因數與數字和的差"},
		check=function(data) return data.div_sum > data.number and data.number > 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value1 = data.div_sum
			result.value2 = data.div_sum-data.number
			return result
		end,
		--https://oeis.org/A005101
		list={[12]=1,[18]=2,[20]=3,[24]=4,[30]=5,[36]=6,[40]=7,[42]=8,[48]=9,[54]=10,
			[56]=11,[60]=12,[66]=13,[70]=14,[72]=15,[78]=16,[80]=17,[84]=18,[88]=19,[90]=20,
			[96]=21,[100]=22,[102]=23,[104]=24,[108]=25,[112]=26,[114]=27,[120]=28,[126]=29,[132]=30,
			[138]=31,[140]=32,[144]=33,[150]=34,[156]=35,[160]=36,[162]=37,[168]=38,[174]=39,[176]=40,
			[180]=41,[186]=42,[192]=43,[196]=44,[198]=45,[200]=46,[204]=47,[208]=48,[210]=49,[216]=50,
			[220]=51,[222]=52,[224]=53,[228]=54,[234]=55,[240]=56,[246]=57,[252]=58,[258]=59,[260]=60,
			[264]=61,[270]=62,[272]=63,[276]=64,[280]=65,[282]=66,[288]=67,[294]=68,[300]=69,[304]=70,
			[306]=71,[308]=72,[312]=73,[318]=74,[320]=75,[324]=76,[330]=77,[336]=78,[340]=79,[342]=80,
			[348]=81,[350]=82,[352]=83,[354]=84,[360]=85,[364]=86,[366]=87,[368]=88,[372]=89,[378]=90,
			[380]=91,[384]=92,[390]=93,[392]=94,[396]=95,[400]=96,[402]=97,[408]=98,[414]=99,[416]=100}
	},
	['完全數']={name="完全數",page="完全数",info="*{{{orderstr}}}{{{property}}},其中,{{{number}}} = {{{value1}}}對應的[[梅森素数]]為{{{value}}}{{{releatedstr}}}。",example=496,
		arg_desc={value="對應的[[梅森素数]]",value1="完全數寫成[[梅森素数]]乘積的式子"},
		check=function(data) return data.div_sum == data.number and data.number > 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			local prims_factors = {}
			for k,v in pairs(data.primedata) do prims_factors[#prims_factors + 1] = k end
			table.sort(prims_factors)
			result.value = prims_factors[#prims_factors]
			if(data.mersenne_prime_for_perfect_number ~= nil and data.mersenne_prime_for_perfect_number~='')then
				result.value1 = data.mersenne_prime_for_perfect_number
			end
			return result
		end,
		--https://oeis.org/A000396
		list={[6]=1, [28]=2, [496]=3, [8128]=4, [33550336]=5, [8589869056]=6, [137438691328]=7}
	},
	['梅森質數']={name="梅森質數",page="梅森素数",info="**{{{orderstr}}}{{{property}}}({{{value1}}}),對應的[[完全數]]為{{{value2}}},{{{value3}}}{{{releatedstr}}}。",example=31,
		arg_desc={value1="以[[梅森数]]表示法表示",
			value2="[[梅森素数]]對應的完全數",
			value2_text="[[梅森素数]]對應的完全數 (不含連結)",
			value3="[[梅森素数]]對應之完全數寫成[[梅森素数]]乘積的式子"},
		value=function(data, otherdata)
			local result = otherdata or {}
			local power_of_2 = tonumber(data.number) + 1
			local log_2 = math.floor( math.log(power_of_2) / math.log(2) + 0.0012 )
			local can_math = ( type( (mw.getCurrentFrame() or {}).callParserFunction )==type(tonumber))
			local prefact = math.pow(2,log_2-1) * tonumber(data.number)
			local mersenne_prime = "2<sup>" .. tonumber(log_2) .. "</sup> - 1"
			if can_math then mersenne_prime = mw.getCurrentFrame():callParserFunction{name = "#tag:math", args = {"2^{" .. tonumber(log_2) .. "}-1"}} end
			result.value1 = mersenne_prime
			result.value2 = tostring(prefact)
			result.value2_text = tostring(prefact)
			if mw.title.new( tostring(prefact), 0).exists then result.value2 = "[[" .. result.value2 .. "]]" end
			local mersenne_prime_prefact = "2<sup>" .. tonumber(log_2-1) .. "</sup> (2<sup>" .. tonumber(log_2) .. "</sup> - 1)"
			if can_math then 
				mersenne_prime_prefact = mw.getCurrentFrame():callParserFunction{name = "#tag:math", args = {
					"2^{" .. tonumber(log_2-1) .. "}\\left(2^{" .. tonumber(log_2) .. "}-1\\right)"}
				} 
			end
			result.value3 = mersenne_prime_prefact
			return result
		end,
		--https://oeis.org/A000668/list
		list={
			[3]=1,[7]=2,[31]=3,[127]=4,[8191]=5,[131071]=6,[524287]=7,[2147483647]=8,
			["2305843009213693951"]=9,["618970019642690137449562111"]=10},max_reason="超出MediaWiki的Lua擴展之整數最大儲存上限,會失去精確度"
	},
	['半完全數']={name="半完全數",page="半完全数",info="**{{{orderstr}}}{{{property}}}{{{valuestr}}}{{{releatedstr}}}。",valuestr=",和為本身的其中一組因數為{{{value}}}",example=24,
		arg_desc={value="一組和為本身的因數",valuestr="預設的數值字串,描述一組和為本身的因數"},
		check=function(data) return #(data.simi_div) > 0 and data.number > 1 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.valuestr = ''
			local body = ''
			if #(data.simi_div) > 0 then
				if data.div_sum ~= data.number then 
					body = "[[" .. tostring( table.concat(data.simi_div, "]]、 [[") ) .. "]]"
				end
			end
			if body and mw.text.trim(body) ~= '' then 
				result.value = body 
				result.valuestr = ",和為本身的其中一組因數為" .. result.value
			end
			return result
		end,
		--https://oeis.org/A005835
		list={[6]=1,[12]=2,[18]=3,[20]=4,[24]=5,[28]=6,[30]=7,[36]=8,[40]=9,[42]=10,
			[48]=11,[54]=12,[56]=13,[60]=14,[66]=15,[72]=16,[78]=17,[80]=18,[84]=19,[88]=20,
			[90]=21,[96]=22,[100]=23,[102]=24,[104]=25,[108]=26,[112]=27,[114]=28,[120]=29,[126]=30,
			[132]=31,[138]=32,[140]=33,[144]=34,[150]=35,[156]=36,[160]=37,[162]=38,[168]=39,[174]=40,
			[176]=41,[180]=42,[186]=43,[192]=44,[196]=45,[198]=46,[200]=47,[204]=48,[208]=49,[210]=50,
			[216]=51,[220]=52,[222]=53,[224]=54,[228]=55,[234]=56,[240]=57,[246]=58,[252]=59,[258]=60,
			[260]=61,[264]=62,[270]=63,[272]=64,[276]=65,[280]=66,[282]=67,[288]=68,[294]=69,[300]=70,
			[304]=71,[306]=72,[308]=73,[312]=74,[318]=75,[320]=76,[324]=77,[330]=78,[336]=79,[340]=80,
			[342]=81,[348]=82,[350]=83,[352]=84,[354]=85,[360]=86,[364]=87,[366]=88,[368]=89,[372]=90,
			[378]=91,[380]=92,[384]=93,[390]=94,[392]=95,[396]=96,[400]=97,[402]=98,[408]=99,[414]=100}
	},
	['本原半完全數']={name="本原半完全數",page="本原半完全数",info="**由於{{{number}}}不能被所有比它小的半完全數整除,因此是{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=28,
		--Alonso del Arte, A006036: Primitive pseudoperfect numbers, https://oeis.org/A006036 , Sep 08 2012, [2018-11-16]
		list={[6]=1,[20]=2,[28]=3,[88]=4,[104]=5,[272]=6,[304]=7,[350]=8,[368]=9,[464]=10,
			[490]=11,[496]=12,[550]=13,[572]=14,[650]=15,[748]=16,[770]=17,[910]=18,[945]=19,[1184]=20,
			[1190]=21,[1312]=22,[1330]=23,[1376]=24,[1430]=25,[1504]=26,[1575]=27,[1610]=28,[1696]=29,[1870]=30,
			[1888]=31,[1952]=32,[2002]=33,[2030]=34,[2090]=35,[2170]=36,[2205]=37,[2210]=38,[2470]=39,[2530]=40,
			[2584]=41,[2590]=42,[2870]=43,[2990]=44,[3010]=45,[3128]=46,[3190]=47,[3230]=48,[3290]=49,[3410]=50,
			[3465]=51,[3496]=52,[3710]=53,[3770]=54,[3944]=55,[4070]=56,[4095]=57,[4130]=58,[4216]=59,[4270]=60,
			[4288]=61,[4408]=62,[4510]=63,[4544]=64,[4672]=65,[4690]=66,[4712]=67,[4730]=68,[4970]=69,[5032]=70,
			[5056]=71,[5110]=72,[5170]=73,[5312]=74,[5336]=75,[5355]=76,[5530]=77,[5576]=78,[5624]=79,[5696]=80,
			[5704]=81,[5775]=82,[5810]=83,[5848]=84,[5985]=85,[6208]=86,[6230]=87,[6232]=88,[6392]=89,[6435]=90,
			[6464]=91,[6536]=92,[6592]=93,[6790]=94,[6808]=95,[6825]=96,[6848]=97,[6976]=98,[7070]=99,[7144]=100}
	},
	['奇異數']={name="奇異數",page="奇異數_(數論)",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=836,
		check=function(data) return data.div_sum > data.number and #(data.simi_div) <= 0 and data.number > 1 and #(data.divdata) <= 32 end,
		--https://oeis.org/A006037
		list={[70]=1, [836]=2, [4030]=3, [5830]=4, [7192]=5, [7912]=6, [9272]=7, [10430]=8, [10570]=9, [10792]=10, 
			[10990]=11, [11410]=12, [11690]=13, [12110]=14, [12530]=15, [12670]=16, [13370]=17, [13510]=18, [13790]=19, [13930]=20}
	},
	['歐爾調和數']={name="歐爾調和數",page="欧尔调和数",info="*{{{orderstr}}}{{{property}}},因數[[调和平均数]]為{{{value}}}{{{releatedstr}}}。",example=270,
		arg_desc={value="正因數的[[调和平均数]]"},
		check=function(data) return p._is_integer(data.div_harmonic_avg) and data.number > 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value = string.format("%d",math.floor(data.div_harmonic_avg))
			return result
		end,
		--https://oeis.org/A001599
		list={[1]=1, [6]=2, [28]=3, [140]=4, [270]=5, [496]=6, [672]=7, [1638]=8, [2970]=9, [6200]=10, 
			[8128]=11, [8190]=12, [18600]=13, [18620]=14, [27846]=15, [30240]=16, [32760]=17, [55860]=18, [105664]=19, [117800]=20}
	},
	['不尋常數']={name="不尋常數",page="不寻常数",info="*{{{orderstr}}}{{{property}}},大於平方根的質因數為{{{value}}}{{{releatedstr}}}。",example=28,
		arg_desc={value="大於平方根的質因數"},
		check=function(data) return data.is_unusual ~= nil and data.number > 1 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			if data.is_unusual ~= nil then
				result.value = data.is_unusual
			end
			return result
		end,
		--https://oeis.org/A064052
		list={[2]=1,[3]=2,[5]=3,[6]=4,[7]=5,[10]=6,[11]=7,[13]=8,[14]=9,[15]=10,
			[17]=11,[19]=12,[20]=13,[21]=14,[22]=15,[23]=16,[26]=17,[28]=18,[29]=19,[31]=20,
			[33]=21,[34]=22,[35]=23,[37]=24,[38]=25,[39]=26,[41]=27,[42]=28,[43]=29,[44]=30,
			[46]=31,[47]=32,[51]=33,[52]=34,[53]=35,[55]=36,[57]=37,[58]=38,[59]=39,[61]=40,
			[62]=41,[65]=42,[66]=43,[67]=44,[68]=45,[69]=46,[71]=47,[73]=48,[74]=49,[76]=50,
			[77]=51,[78]=52,[79]=53,[82]=54,[83]=55,[85]=56,[86]=57,[87]=58,[88]=59,[89]=60,
			[91]=61,[92]=62,[93]=63,[94]=64,[95]=65,[97]=66,[99]=67,[101]=68,[102]=69,[103]=70,
			[104]=71,[106]=72,[107]=73,[109]=74,[110]=75,[111]=76,[113]=77,[114]=78,[115]=79,[116]=80,
			[117]=81,[118]=82,[119]=83,[122]=84,[123]=85,[124]=86,[127]=87,[129]=88,[130]=89,[131]=90,
			[133]=91,[134]=92,[136]=93,[137]=94,[138]=95,[139]=96,[141]=97,[142]=98,[143]=99,[145]=100}
	},
	['半質數']={name="半質數",page="半素数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=35,
		check=function(data) return data.exp_num == 2 and data.number > 1 end,
		--https://oeis.org/A001358
		list={[4]=1,[6]=2,[9]=3,[10]=4,[14]=5,[15]=6,[21]=7,[22]=8,[25]=9,[26]=10,
			[33]=11,[34]=12,[35]=13,[38]=14,[39]=15,[46]=16,[49]=17,[51]=18,[55]=19,[57]=20,
			[58]=21,[62]=22,[65]=23,[69]=24,[74]=25,[77]=26,[82]=27,[85]=28,[86]=29,[87]=30,
			[91]=31,[93]=32,[94]=33,[95]=34,[106]=35,[111]=36,[115]=37,[118]=38,[119]=39,[121]=40,
			[122]=41,[123]=42,[129]=43,[133]=44,[134]=45,[141]=46,[142]=47,[143]=48,[145]=49,[146]=50,
			[155]=51,[158]=52,[159]=53,[161]=54,[166]=55,[169]=56,[177]=57,[178]=58,[183]=59,[185]=60,
			[187]=61,[194]=62,[201]=63,[202]=64,[203]=65,[205]=66,[206]=67,[209]=68,[213]=69,[214]=70,
			[215]=71,[217]=72,[218]=73,[219]=74,[221]=75,[226]=76,[235]=77,[237]=78,[247]=79,[249]=80,
			[253]=81,[254]=82,[259]=83,[262]=84,[265]=85,[267]=86,[274]=87,[278]=88,[287]=89,[289]=90,
			[291]=91,[295]=92,[298]=93,[299]=94,[301]=95,[302]=96,[303]=97,[305]=98,[309]=99,[314]=100}
	},
	['佩服數']={name="佩服數",page="佩服数",info="*{{{orderstr}}}{{{property}}},相減後為本身的[[因數]]為{{{value}}}{{{releatedstr}}}。",example=24,
		arg_desc={value="除了這個真因數之和,將結果減去後為本身的[[因數]]"},
		check=function(data) return data.admirable_div ~= nil and data.number > 1 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value = data.admirable_div
			return result
		end,
		--https://oeis.org/A111592
		list={[12]=1,[20]=2,[24]=3,[30]=4,[40]=5,[42]=6,[54]=7,[56]=8,[66]=9,[70]=10,
			[78]=11,[84]=12,[88]=13,[102]=14,[104]=15,[114]=16,[120]=17,[138]=18,[140]=19,[174]=20,
			[186]=21,[222]=22,[224]=23,[234]=24,[246]=25,[258]=26,[270]=27,[282]=28,[308]=29,[318]=30,
			[354]=31,[364]=32,[366]=33,[368]=34,[402]=35,[426]=36,[438]=37,[464]=38,[474]=39,[476]=40,
			[498]=41,[532]=42,[534]=43,[582]=44,[606]=45,[618]=46,[642]=47,[644]=48,[650]=49,[654]=50,
			[672]=51,[678]=52,[762]=53,[786]=54,[812]=55,[822]=56,[834]=57,[836]=58,[868]=59,[894]=60,
			[906]=61,[942]=62,[945]=63,[978]=64,[992]=65,[1002]=66,[1036]=67,[1038]=68,[1074]=69,[1086]=70,
			[1146]=71,[1148]=72,[1158]=73,[1182]=74,[1194]=75,[1204]=76,[1266]=77,[1316]=78,[1338]=79,[1362]=80,
			[1372]=81,[1374]=82,[1398]=83,[1434]=84,[1446]=85,[1484]=86,[1488]=87,[1504]=88,[1506]=89,[1542]=90,
			[1578]=91,[1614]=92,[1626]=93,[1638]=94,[1652]=95,[1662]=96,[1686]=97,[1698]=98,[1708]=99,[1758]=100}
	},
	['無平方數因數的數']={name="無平方數因數的數",page="无平方数因数的数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=35,
		check=function(data) return data.exp_num == data.prime_count and data.number > 1 end,
		--https://oeis.org/A005117
		list={[1]=1,[2]=2,[3]=3,[5]=4,[6]=5,[7]=6,[10]=7,[11]=8,[13]=9,[14]=10,
			[15]=11,[17]=12,[19]=13,[21]=14,[22]=15,[23]=16,[26]=17,[29]=18,[30]=19,[31]=20,
			[33]=21,[34]=22,[35]=23,[37]=24,[38]=25,[39]=26,[41]=27,[42]=28,[43]=29,[46]=30,
			[47]=31,[51]=32,[53]=33,[55]=34,[57]=35,[58]=36,[59]=37,[61]=38,[62]=39,[65]=40,
			[66]=41,[67]=42,[69]=43,[70]=44,[71]=45,[73]=46,[74]=47,[77]=48,[78]=49,[79]=50,
			[82]=51,[83]=52,[85]=53,[86]=54,[87]=55,[89]=56,[91]=57,[93]=58,[94]=59,[95]=60,
			[97]=61,[101]=62,[102]=63,[103]=64,[105]=65,[106]=66,[107]=67,[109]=68,[110]=69,[111]=70,
			[113]=71,[114]=72,[115]=73,[118]=74,[119]=75,[122]=76,[123]=77,[127]=78,[129]=79,[130]=80,
			[131]=81,[133]=82,[134]=83,[137]=84,[138]=85,[139]=86,[141]=87,[142]=88,[143]=89,[145]=90,
			[146]=91,[149]=92,[151]=93,[154]=94,[155]=95,[157]=96,[158]=97,[159]=98,[161]=99,[163]=100}
	},
	['楔形數']={name="楔形數",page="楔形数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=30,
		check=function(data) return data.exp_num == data.prime_count and data.prime_count == 3 and data.number > 1 end,
		-- Harvey P. Dale, A007304: Sphenic numbers: products of 3 distinct primes, https://oeis.org/A007304 , Jan 08 2015, [2018-11-03] 
		list={[30]=1,[42]=2,[66]=3,[70]=4,[78]=5,[102]=6,[105]=7,[110]=8,[114]=9,[130]=10,
			[138]=11,[154]=12,[165]=13,[170]=14,[174]=15,[182]=16,[186]=17,[190]=18,[195]=19,[222]=20,
			[230]=21,[231]=22,[238]=23,[246]=24,[255]=25,[258]=26,[266]=27,[273]=28,[282]=29,[285]=30,
			[286]=31,[290]=32,[310]=33,[318]=34,[322]=35,[345]=36,[354]=37,[357]=38,[366]=39,[370]=40,
			[374]=41,[385]=42,[399]=43,[402]=44,[406]=45,[410]=46,[418]=47,[426]=48,[429]=49,[430]=50,
			[434]=51,[435]=52,[438]=53,[442]=54,[455]=55,[465]=56,[470]=57,[474]=58,[483]=59,[494]=60,
			[498]=61,[506]=62,[518]=63,[530]=64,[534]=65,[555]=66,[561]=67,[574]=68,[582]=69,[590]=70,
			[595]=71,[598]=72,[602]=73,[606]=74,[609]=75,[610]=76,[615]=77,[618]=78,[627]=79,[638]=80,
			[642]=81,[645]=82,[646]=83,[651]=84,[654]=85,[658]=86,[663]=87,[665]=88,[670]=89,[678]=90,
			[682]=91,[705]=92,[710]=93,[715]=94,[730]=95,[741]=96,[742]=97,[754]=98,[759]=99,[762]=100}
	},
	['平方數']={name="平方數",page="平方数",info="*{{{orderstr}}}{{{property}}},為{{{value}}}的平方{{{releatedstr}}}。",example=25,
		arg_desc={value="這個數字的平方根"},
		check=function(data) return p._is_integer(data.num_sqrt) and data.number >= 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			if p._is_integer(data.num_sqrt) then
				result.value = string.format("%d",math.floor(data.num_sqrt))
			end
			return result
		end,
		--https://oeis.org/A000290
		list={[1]=1,[4]=2,[9]=3,[16]=4,[25]=5,[36]=6,[49]=7,[64]=8,[81]=9,[100]=10,
			[121]=11,[144]=12,[169]=13,[196]=14,[225]=15,[256]=16,[289]=17,[324]=18,[361]=19,[400]=20,
			[441]=21,[484]=22,[529]=23,[576]=24,[625]=25,[676]=26,[729]=27,[784]=28,[841]=29,[900]=30,
			[961]=31,[1024]=32,[1089]=33,[1156]=34,[1225]=35,[1296]=36,[1369]=37,[1444]=38,[1521]=39,[1600]=40,
			[1681]=41,[1764]=42,[1849]=43,[1936]=44,[2025]=45,[2116]=46,[2209]=47,[2304]=48,[2401]=49,[2500]=50}
	},
	['立方數']={name="立方數",page="立方數",info="*{{{orderstr}}}{{{property}}},為{{{value}}}的立方{{{releatedstr}}}。",example=27,
		arg_desc={value="這個數字的立方根"},
		check=function(data) return p._is_integer(math.pow(data.number,1.0/3.0)) and data.number >= 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			local cbrt = math.pow(data.number,1.0/3.0)
			cbrt = tonumber(string.format("%f",cbrt))
			if p._is_integer(cbrt) then
				result.value = string.format("%d",math.floor(cbrt))
			end
			return result
		end,
		--https://oeis.org/A000578
		list={[1]=1,[8]=2,[27]=3,[64]=4,[125]=5,[216]=6,[343]=7,[512]=8,[729]=9,[1000]=10,
			[1331]=11,[1728]=12,[2197]=13,[2744]=14,[3375]=15,[4096]=16,[4913]=17,[5832]=18,[6859]=19,[8000]=20,
			[9261]=21,[10648]=22}
	},
	['普洛尼克數']={name="普洛尼克數",page="普洛尼克数",info="*{{{orderstr}}}{{{property}}},為{{{value1}}}與{{{value2}}}的乘積{{{releatedstr}}}。",example=42,
		arg_desc={value1="兩個連續的非負整數中較小者,其與value2的乘積構成一個普洛尼克數",value2="兩個連續的非負整數中較大者,其與value1的乘積構成一個普洛尼克數"},
		check=function(data) return (not p._is_equal(math.ceil(data.num_sqrt), math.floor(data.num_sqrt))) and
			p._is_equal(math.floor(data.num_sqrt) * (math.floor(data.num_sqrt)+1) , data.number) and data.number >= 0 end,
		value=function(data, otherdata)
			local result = otherdata or {}
			result.value1 = string.format("%d",math.floor(data.num_sqrt))
			result.value2 = string.format("%d",math.floor(data.num_sqrt))+1
			return result
		end,
		--https://oeis.org/A002378
		list={[0]=1,[2]=2,[6]=3,[12]=4,[20]=5,[30]=6,[42]=7,[56]=8,[72]=9,[90]=10,
			[110]=11,[132]=12,[156]=13,[182]=14,[210]=15,[240]=16,[272]=17,[306]=18,[342]=19,[380]=20,
			[420]=21,[462]=22,[506]=23,[552]=24,[600]=25,[650]=26,[702]=27,[756]=28,[812]=29,[870]=30,
			[930]=31,[992]=32,[1056]=33,[1122]=34,[1190]=35,[1260]=36,[1332]=37,[1406]=38,[1482]=39,[1560]=40,
			[1640]=41,[1722]=42,[1806]=43,[1892]=44,[1980]=45,[2070]=46,[2162]=47,[2256]=48,[2352]=49,[2450]=50,
			[2550]=51,[2652]=52,[2756]=53,[2862]=54,[2970]=55,[3080]=56,[3192]=57,[3306]=58,[3422]=59,[3540]=60,
			[3660]=61,[3782]=62,[3906]=63,[4032]=64,[4160]=65,[4290]=66,[4422]=67,[4556]=68,[4692]=69,[4830]=70,
			[4970]=71,[5112]=72,[5256]=73,[5402]=74,[5550]=75,[5700]=76,[5852]=77,[6006]=78,[6162]=79,[6320]=80,
			[6480]=81,[6642]=82,[6806]=83,[6972]=84,[7140]=85,[7310]=86,[7482]=87,[7656]=88,[7832]=89,[8010]=90,
			[8190]=91,[8372]=92,[8556]=93,[8742]=94,[8930]=95,[9120]=96,[9312]=97,[9506]=98,[9702]=99,[9900]=100}
	},
	['自我數']={name="自我數",page="自我数",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=53,
		--https://oeis.org/A003052
		list={[1]=1,[3]=2,[5]=3,[7]=4,[9]=5,[20]=6,[31]=7,[42]=8,[53]=9,[64]=10,
			[75]=11,[86]=12,[97]=13,[108]=14,[110]=15,[121]=16,[132]=17,[143]=18,[154]=19,[165]=20,
			[176]=21,[187]=22,[198]=23,[209]=24,[211]=25,[222]=26,[233]=27,[244]=28,[255]=29,[266]=30,
			[277]=31,[288]=32,[299]=33,[310]=34,[312]=35,[323]=36,[334]=37,[345]=38,[356]=39,[367]=40,
			[378]=41,[389]=42,[400]=43,[411]=44,[413]=45,[424]=46,[435]=47,[446]=48,[457]=49,[468]=50,
			[479]=51,[490]=52,[501]=53,[512]=54,[514]=55,[525]=56,[536]=57,[547]=58,[558]=59,[569]=60,
			[580]=61,[591]=62,[602]=63,[613]=64,[615]=65,[626]=66,[637]=67,[648]=68,[659]=69,[670]=70,
			[681]=71,[692]=72,[703]=73,[714]=74,[716]=75,[727]=76,[738]=77,[749]=78,[760]=79,[771]=80,
			[782]=81,[793]=82,[804]=83,[815]=84,[817]=85,[828]=86,[839]=87,[850]=88,[861]=89,[872]=90,
			[883]=91,[894]=92,[905]=93,[916]=94,[918]=95,[929]=96,[940]=97,[951]=98,[962]=99,[973]=100}
	},
	['哈沙德數']={name="哈沙德數",page="哈沙德數",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=27,
		check=function(data) 
			local sum, str = 0, tostring(math.abs(math.floor(data.number)))
			--數字逐位相加
			for i = 1,#str do sum = sum + tonumber(str:sub(i,i)) end
			--判斷位數和是否整除自身 (餘數為0)
			return data.number % sum == 0 
		end,
		--https://oeis.org/A005349
		list={[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,[6]=6,[7]=7,[8]=8,[9]=9,[10]=10,
			[12]=11,[18]=12,[20]=13,[21]=14,[24]=15,[27]=16,[30]=17,[36]=18,[40]=19,[42]=20,
			[45]=21,[48]=22,[50]=23,[54]=24,[60]=25,[63]=26,[70]=27,[72]=28,[80]=29,[81]=30,
			[84]=31,[90]=32,[100]=33,[102]=34,[108]=35,[110]=36,[111]=37,[112]=38,[114]=39,[117]=40,
			[120]=41,[126]=42,[132]=43,[133]=44,[135]=45,[140]=46,[144]=47,[150]=48,[152]=49,[153]=50,
			[156]=51,[162]=52,[171]=53,[180]=54,[190]=55,[192]=56,[195]=57,[198]=58,[200]=59,[201]=60,
			[204]=61,[207]=62,[209]=63,[210]=64,[216]=65,[220]=66,[222]=67,[224]=68,[225]=69,[228]=70,
			[230]=71,[234]=72,[240]=73,[243]=74,[247]=75,[252]=76,[261]=77,[264]=78,[266]=79,[270]=80,
			[280]=81,[285]=82,[288]=83,[300]=84,[306]=85,[308]=86,[312]=87,[315]=88,[320]=89,[322]=90,
			[324]=91,[330]=92,[333]=93,[336]=94,[342]=95,[351]=96,[360]=97,[364]=98,[370]=99,[372]=100}
	},
	['全哈沙德數']={name="全哈沙德數",page="哈沙德數",info="**{{{orderstr}}}{{{property}}},即在所有[[进位制]]中皆為[[哈沙德數]]{{{releatedstr}}}。",example=4,
		list={[1]=1,[2]=2,[4]=3,[6]=4},max_reason="只有四個全哈沙德數"
	},
	['史密夫數']={name="史密夫數",page="史密夫數",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=27,
		check=function(data) 
			local sum, nsum, str = 0, 0, tostring(math.abs(math.floor(data.number)))
			--數字逐位相加
			for k,v in pairs(data.primedata) do 
				if k > 0 and k ~= 1 and k ~= data.number then
					local str, fsum = tostring(k), 0
					for j=1,#str do fsum = fsum + tonumber(str:sub(j,j))end
					sum = sum + fsum * v
				end
			end
			for i = 1,#str do nsum = nsum + tonumber(str:sub(i,i)) end
			--判斷位數和是否整除自身 (餘數為0)
			return data.number > 0 and sum == nsum
		end,
		--https://oeis.org/A006753
		list={[4]=1,[22]=2,[27]=3,[58]=4,[85]=5,[94]=6,[121]=7,[166]=8,[202]=9,[265]=10,
			[274]=11,[319]=12,[346]=13,[355]=14,[378]=15,[382]=16,[391]=17,[438]=18,[454]=19,[483]=20,
			[517]=21,[526]=22,[535]=23,[562]=24,[576]=25,[588]=26,[627]=27,[634]=28,[636]=29,[645]=30,
			[648]=31,[654]=32,[663]=33,[666]=34,[690]=35,[706]=36,[728]=37,[729]=38,[762]=39,[778]=40,
			[825]=41,[852]=42,[861]=43,[895]=44,[913]=45,[915]=46,[922]=47,[958]=48,[985]=49,[1086]=50,
			[1111]=51,[1165]=52,[1219]=53,[1255]=54,[1282]=55,[1284]=56,[1376]=57,[1449]=58,[1507]=59,[1581]=60,
			[1626]=61,[1633]=62,[1642]=63,[1678]=64,[1736]=65,[1755]=66,[1776]=67,[1795]=68,[1822]=69,[1842]=70,
			[1858]=71,[1872]=72,[1881]=73,[1894]=74,[1903]=75,[1908]=76,[1921]=77,[1935]=78,[1952]=79,[1962]=80,
			[1966]=81,[2038]=82,[2067]=83,[2079]=84,[2155]=85,[2173]=86,[2182]=87,[2218]=88,[2227]=89,[2265]=90,
			[2286]=91,[2326]=92,[2362]=93,[2366]=94,[2373]=95,[2409]=96,[2434]=97,[2461]=98,[2475]=99,[2484]=100}
	},
	['等數位數']={name="等數位數",page="等数位数",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=27,
		check=function(data) return data.prime_digits == data.num_digts and data.number > 0 end,
		--Jayanta Basu, A046758: Equidigital numbers, https://oeis.org/A046758 , Jun 28 2013, [2018-11-03]
		list={[1]=1,[2]=2,[3]=3,[5]=4,[7]=5,[10]=6,[11]=7,[13]=8,[14]=9,[15]=10,
			[16]=11,[17]=12,[19]=13,[21]=14,[23]=15,[25]=16,[27]=17,[29]=18,[31]=19,[32]=20,
			[35]=21,[37]=22,[41]=23,[43]=24,[47]=25,[49]=26,[53]=27,[59]=28,[61]=29,[64]=30,
			[67]=31,[71]=32,[73]=33,[79]=34,[81]=35,[83]=36,[89]=37,[97]=38,[101]=39,[103]=40,
			[105]=41,[106]=42,[107]=43,[109]=44,[111]=45,[112]=46,[113]=47,[115]=48,[118]=49,[119]=50,
			[121]=51,[122]=52,[123]=53,[127]=54,[129]=55,[131]=56,[133]=57,[134]=58,[135]=59,[137]=60,
			[139]=61,[141]=62,[142]=63,[145]=64,[146]=65,[147]=66,[149]=67,[151]=68,[155]=69,[157]=70,
			[158]=71,[159]=72,[160]=73,[161]=74,[162]=75,[163]=76,[166]=77,[167]=78,[169]=79,[173]=80,
			[175]=81,[177]=82,[178]=83,[179]=84,[181]=85,[183]=86,[185]=87,[189]=88,[191]=89,[192]=90,
			[193]=91,[194]=92,[197]=93,[199]=94,[201]=95,[203]=96,[205]=97,[211]=98,[213]=99,[215]=100}
	},
	['節儉數']={name="節儉數",page="节俭数",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=128,
		check=function(data) return data.prime_digits < data.num_digts and data.number > 0 end,
		--https://oeis.org/A046759
		list={[125]=1,[128]=2,[243]=3,[256]=4,[343]=5,[512]=6,[625]=7,[729]=8,[1024]=9,[1029]=10,
			[1215]=11,[1250]=12,[1280]=13,[1331]=14,[1369]=15,[1458]=16,[1536]=17,[1681]=18,[1701]=19,[1715]=20,
			[1792]=21,[1849]=22,[1875]=23,[2048]=24,[2187]=25,[2197]=26,[2209]=27,[2401]=28,[2560]=29,[2809]=30,
			[3125]=31,[3481]=32,[3584]=33,[3645]=34,[3721]=35,[4096]=36,[4374]=37,[4375]=38,[4489]=39,[4802]=40}
	},
	['奢侈數']={name="奢侈數",page="奢侈数",info="*{{{orderstr}}}[[十进制]]的{{{property}}}{{{releatedstr}}}。",example=24,
		check=function(data) return data.prime_digits > data.num_digts and data.number > 0 end,
		--https://oeis.org/A046760
		list={[4]=1,[6]=2,[8]=3,[9]=4,[12]=5,[18]=6,[20]=7,[22]=8,[24]=9,[26]=10,
			[28]=11,[30]=12,[33]=13,[34]=14,[36]=15,[38]=16,[39]=17,[40]=18,[42]=19,[44]=20,
			[45]=21,[46]=22,[48]=23,[50]=24,[51]=25,[52]=26,[54]=27,[55]=28,[56]=29,[57]=30,
			[58]=31,[60]=32,[62]=33,[63]=34,[65]=35,[66]=36,[68]=37,[69]=38,[70]=39,[72]=40,
			[74]=41,[75]=42,[76]=43,[77]=44,[78]=45,[80]=46,[82]=47,[84]=48,[85]=49,[86]=50,
			[87]=51,[88]=52,[90]=53,[91]=54,[92]=55,[93]=56,[94]=57,[95]=58,[96]=59,[98]=60,
			[99]=61,[100]=62,[102]=63,[104]=64,[108]=65,[110]=66,[114]=67,[116]=68,[117]=69,[120]=70,
			[124]=71,[126]=72,[130]=73,[132]=74,[136]=75,[138]=76,[140]=77,[143]=78,[144]=79,[148]=80,
			[150]=81,[152]=82,[153]=83,[154]=84,[156]=85,[164]=86,[165]=87,[168]=88,[170]=89,[171]=90,
			[172]=91,[174]=92,[176]=93,[180]=94,[182]=95,[184]=96,[186]=97,[187]=98,[188]=99,[190]=100}
	},
	['不可及數']={name="不可及數",page="不可及数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=52,
		--Jean-François Alcover, after Benoit Cloitre, Untouchable numbers. https://oeis.org/A005114 Jun 29 2012, [2018-11-03]
		list={[2]=1,[5]=2,[52]=3,[88]=4,[96]=5,[120]=6,[124]=7,[146]=8,[162]=9,[188]=10,
			[206]=11,[210]=12,[216]=13,[238]=14,[246]=15,[248]=16,[262]=17,[268]=18,[276]=19,[288]=20,
			[290]=21,[292]=22,[304]=23,[306]=24,[322]=25,[324]=26,[326]=27,[336]=28,[342]=29,[372]=30,
			[406]=31,[408]=32,[426]=33,[430]=34,[448]=35,[472]=36,[474]=37,[498]=38,[516]=39,[518]=40,
			[520]=41,[530]=42,[540]=43,[552]=44,[556]=45,[562]=46,[576]=47,[584]=48,[612]=49,[624]=50,
			[626]=51,[628]=52,[658]=53,[668]=54,[670]=55,[708]=56,[714]=57,[718]=58,[726]=59,[732]=60,
			[738]=61,[748]=62,[750]=63,[756]=64,[766]=65,[768]=66,[782]=67,[784]=68,[792]=69,[802]=70,
			[804]=71,[818]=72,[836]=73,[848]=74,[852]=75,[872]=76,[892]=77,[894]=78,[896]=79,[898]=80,
			[902]=81,[926]=82,[934]=83,[936]=84,[964]=85,[966]=86,[976]=87,[982]=88,[996]=89,[1002]=90,
			[1028]=91,[1044]=92,[1046]=93,[1060]=94,[1068]=95,[1074]=96,[1078]=97,[1080]=98,[1102]=99,[1116]=100}
	},
	['可作圖多邊形']={name="可作圖多邊形",page="可作图多边形",info="*{{{value}}}為{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=24,
		value=function(data, otherdata)
			local result = otherdata or {}
			local shape_str = nil
			if tonumber(data.number) == 4 then shape_str = '方' else
				shape_str = require("Module:NumberToChinese")._numberToChinese(data.number)
			end
			result.value ='正' .. (shape_str or tostring(data.number)) .. (({[3]="角形",[4]='形'})[data.number] or "邊形")
			return result
		end,
		--https://oeis.org/A003401
		list={[3]=1,[4]=2,[5]=3,[6]=4,[8]=5,[10]=6,[12]=7,[15]=8,[16]=9,[17]=10,
			[20]=11,[24]=12,[30]=13,[32]=14,[34]=15,[40]=16,[48]=17,[51]=18,[60]=19,[64]=20,
			[68]=21,[80]=22,[85]=23,[96]=24,[102]=25,[120]=26,[128]=27,[136]=28,[160]=29,[170]=30,
			[192]=31,[204]=32,[240]=33,[255]=34,[256]=35,[257]=36,[272]=37,[320]=38,[340]=39,[384]=40,
			[408]=41,[480]=42,[510]=43,[512]=44,[514]=45,[544]=46,[640]=47,[680]=48,[768]=49,[771]=50,
			[816]=51,[960]=52,[1020]=53,[1024]=54,[1028]=55,[1088]=56,[1280]=57,[1285]=58,[1360]=59,[1536]=60,
			[1542]=61,[1632]=62,[1920]=63,[2040]=64,[2048]=65,[2056]=66,[2176]=67,[2560]=68,[2570]=69,[2720]=70,
			[3072]=71,[3084]=72,[3264]=73,[3840]=74,[3855]=75,[4080]=76,[4096]=77,[4112]=78,[4352]=79,[4369]=80,
			[5120]=81,[5140]=82,[5440]=83,[6144]=84,[6168]=85,[6528]=86,[7680]=87,[7710]=88,[8160]=89,[8192]=90,
			[8224]=91,[8704]=92,[8738]=93,[10240]=94,[10280]=95,[10880]=96,[12288]=97,[12336]=98,[13056]=99,[13107]=100}
	},
	['高合成數']={name="高合成數",page="高合成数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=24,
		--https://oeis.org/A002182
		list={[1]=1,[2]=2,[4]=3,[6]=4,[12]=5,[24]=6,[36]=7,[48]=8,[60]=9,[120]=10,
			[180]=11,[240]=12,[360]=13,[720]=14,[840]=15,[1260]=16,[1680]=17,[2520]=18,[5040]=19,[7560]=20,
			[10080]=21,[15120]=22,[20160]=23,[25200]=24,[27720]=25,[45360]=26,[50400]=27,[55440]=28,[83160]=29,[110880]=30,
			[166320]=31,[221760]=32,[277200]=33,[332640]=34,[498960]=35,[554400]=36,[665280]=37,[720720]=38,[1081080]=39,[1441440]=40,[2162160]=41}
	},
	['階乘']={name="階乘",page="階乘",info="*{{{order}}}的{{{property}}}{{{releatedstr}}}。",example=24,
		--https://oeis.org/A000142
		list={[1]=1,[2]=2,[6]=3,[24]=4,[120]=5,[720]=6,[5040]=7,[40320]=8,[362880]=9,[3628800]=10}
	},
	['質數階乘']={name="質數階乘",page="質數階乘",info="*{{{orderstr}}}{{{property}}},即前{{{order}}}個質數的乘積{{{releatedstr}}}。",example=30,
		--https://oeis.org/A002110
		list={[2]=1,[6]=2,[30]=3,[210]=4,[2310]=5,[30030]=6,[510510]=7,[9699690]=8,[223092870]=9,[6469693230]=10}
	},
	['斐波那契數']={name="斐波那契數",page="斐波那契数列",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=34,
		fib_checker = function(fib_x) return math.floor( 2.0780869212350275376 * math.log(2.2360679774997896964*fib_x) + 0.5) end,
		fibx=function(fib_x) return math.floor(0.44721359549995793928 * (-1 * 
						math.pow(-0.61803398874989484820,fib_x) + math.pow(1.6180339887498948482,fib_x)) + 0.5) end,
		value=function(data, otherdata)
			local result = otherdata or {}
			local test_fib = tonumber(data.number)
			local checker = p.numberFormat['斐波那契數'].fib_checker(test_fib)
			local check_result = p.numberFormat['斐波那契數'].fibx(checker)
			if math.abs(test_fib - check_result) < 1e-14 then
				result.last = p.numberFormat['斐波那契數'].fibx(checker-1)
				result.next = p.numberFormat['斐波那契數'].fibx(checker+1)
				result.order = checker
			end
			return result
		end,
		check=function(data) 
			local test_fib = tonumber(data.number)
			if p.numberFormat['斐波那契數'].list[tonumber(data.number)] ~= nil then 
				return true 
			elseif test_fib > 514229 then
				local checker = p.numberFormat['斐波那契數'].fib_checker(test_fib)
				local check_result = p.numberFormat['斐波那契數'].fibx(checker)
				return math.abs(test_fib - check_result) < 1e-14
			end
			return false
		end,
		--https://oeis.org/A000045
		list={[0]=0,[1]=1,[1]=2,[2]=3,[3]=4,[5]=5,[8]=6,[13]=7,[21]=8,[34]=9,[55]=10,
			[89]=11,[144]=12,[233]=13,[377]=14,[610]=15,[987]=16,[1597]=17,[2584]=18,[4181]=19,[6765]=20,
			[10946]=21,[17711]=22,[28657]=23,[46368]=24,[75025]=25,[121393]=26,[196418]=27,[317811]=28,[514229]=29,[832040]=30}
	},
	['佩爾數']={name="佩爾數",page="佩尔数",info="*{{{orderstr}}}{{{property}}}{{{releatedstr}}}。",example=29,
		pell_checker = function(pell_x) return math.floor( 1.1345926571065109841 * math.log(2.8284271247461900976*pell_x) + 0.5) end,
		pellx=function(pell_x) return math.floor(0.35355339059327376220 * (-1 * 
						math.pow(-0.41421356237309504880,pell_x) + math.pow(2.4142135623730950488,pell_x)) + 0.5) end,
		value=function(data, otherdata)
			local result = otherdata or {}
			local test_pell = tonumber(data.number)
			local checker = p.numberFormat['佩爾數'].pell_checker(test_pell)
			local check_result = p.numberFormat['佩爾數'].pellx(checker)
			if math.abs(test_pell - check_result) < 1e-14 then
				result.last = p.numberFormat['佩爾數'].pellx(checker-1)
				result.next = p.numberFormat['佩爾數'].pellx(checker+1)
				result.order = checker
			end
			return result
		end,
		check=function(data) 
			local test_pell = tonumber(data.number)
			if p.numberFormat['佩爾數'].list[tonumber(data.number)] ~= nil then 
				return true 
			elseif test_fib > 6625109 then
				local checker = p.numberFormat['佩爾數'].pell_checker(test_pell)
				local check_result = p.numberFormat['佩爾數'].pellx(checker)
				return math.abs(test_pell - check_result) < 1e-14
			end
			return false
		end,
		--https://oeis.org/A000045
		list={[0]=0,[1]=1,[2]=2,[5]=3,[12]=4,[29]=5,[70]=6,[169]=7,[408]=8,[985]=9,[2378]=10,
			[5741]=11,[13860]=12,[33461]=13,[80782]=14,[195025]=15,[470832]=16,[1136689]=17,[2744210]=18,[6625109]=19,[15994428]=20}
	},
}

--(* Mathematica Code *)
--FuncQ (* = ; Insert The OEIS Code for check number there*);
--Module[{result = "{", firstPrint = True, thedata}, 
--	thedata (* = ; Insert The OEIS Code for list number there*);
--	Do[
--		If[firstPrint == True, 
--			firstPrint = False,
--		(*Else*)
--			result = result <> ","
--		];
--  	result = result <> "[" <> ToString[thedata[[i]]] <> "]=" <> ToString[i], {i,1, 100}
--	];
--result <> "}"]

--格式化字串的處理,會將特殊的 {{{}}} 轉換
function p._getEscapeString(str) str = mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(mw.ustring.gsub(str, "%[", "%["), "%]", "%]"), "%{", "%{"), "%}", "%}"), "%%", "%%%%"), "%)", "%)"), "%-", "%-"), "%^", "%^"), "%$", "%$"), "%(", "%("), "%.", "%."), "%*", "%*"), "%+", "%+"), "%|", "%|"); return str; end --[[mw:Extension:Scribunto/Lua_reference_manual#number]] --[[ 取小數9位 避免 lua 浮點數 運算誤差 ]] function p._is_integer(num) return math.abs(tonumber(num) - math.floor(tonumber(num))) <= 1e-9 end function p._is_equal(num_left, num_right) return math.abs(tonumber(num_left) - tonumber(num_right)) <= 1e-9 end function p._getFormatingStringByArgument(str, args)
	local result = str or "*{{{1}}}\n"
	for k,v in pairs(args) do
		local ke = p._getEscapeString(k)
		result = mw.ustring.gsub(result, "%{%{%{%s*".. ke .. "%s*%}%}%}", tostring(args[k]) )
	end
	return result
end

function p.getIntegerInfoPrinter()
	IntegerInfoPrinter = {
		number = 0,
		is_gprime = false,
		is_prime = true, --表示數字是否為質數
		num_sqrt = 0, --表示數字的平方根
		admirable_div = nil, --表示佩服數的相減因數
		is_unusual = nil, --表示數字是否有大於平方根的質因數
		div_sum = 0, --因數和
		prime_count = 0, --相異質因數個數
		div_sum_harmonic = 0, --因數調和總和
		div_harmonic_avg = 0.001, --因數調和平均數
		div_count = 0, --因數數量
		exp_num = 0, --質因數總指數 (Ω)
		prime_digits = 0,
		divdata = {},
		primedata = {},
		simi_div = {},
		factors_str = '',
		gfactors_str = ''
	}
	function IntegerInfoPrinter:init(datas)
		self.number = datas.number
		self.is_prime = datas.is_prime --表示數字是否為質數
		self.num_sqrt = math.sqrt(datas.number) --表示數字的平方根
		self.admirable_div = datas.admirable_div --表示佩服數的相減因數
		self.is_unusual = datas.is_unusual --表示數字是否有大於平方根的質因數
		self.div_sum = datas.div_sum --因數和
		self.prime_count = datas.prime_count --相異質因數個數
		self.div_sum_harmonic = datas.div_sum_harmonic --因數調和總和
		self.div_harmonic_avg = datas.div_harmonic_avg --因數調和平均數
		self.div_count = datas.div_count --因數數量
		self.exp_num = datas.exp_num --質因數總指數 (Ω)
		self.prime_digits = datas.prime_digits
		self.buffer_text = datas.buffer_text
		self.divdata = datas.divdata
		self.primedata = datas.primedata
		self.simi_div = datas.simi_div
		self.factors_str = datas.factors_str
		self.mersenne_prime_for_perfect_number = datas.mersenne_prime_for_perfect_number
		self.is_gprime=datas.is_gprime
		self.gfactors_str=datas.gfactors_str
		self.num_digts = mw.ustring.len( mw.ustring.format( "%d",math.floor(math.abs(datas.number)) ) ) 
		if self.is_prime == true then
			if p.PrimeTable.table_max == nil then p.PrimeTable = require('Module:Factorization') end
			self.next_p = p.PrimeTable._nextPrime(self.number)
			self.last_p = p.PrimeTable._lastPrime(self.number)
			self.index_p = p.PrimeTable.lists[number]
		end
	end
	
	function IntegerInfoPrinter:getValue(propetry)
		local datainfo = p.numberFormat[propetry]
		local value = { null='' }
		local check = false

		if datainfo then
			value.number = self.number
			value.releatedstr = ''
			value.orderstr = ''
			value.property = ''
			if datainfo.page == datainfo.name then 
				value.property = "[[" .. datainfo.page .. "]]"
			elseif datainfo.page and datainfo.name then
				value.property = "[[" .. datainfo.page .. '|' .. datainfo.name .. "]]"
			else
				value.property = datainfo.name
			end
			local is_checked = false
			if datainfo.list ~= nil and datainfo.list[self.number] ~= nil then
				value.order = datainfo.list[self.number]
				value.orderstr = "第" .. value.order .. "個"

				for k,v in pairs(datainfo.list) do
					if v == value.order - 1 then value.last = k end
					if v == value.order + 1 then value.next = k end
					if value.last and value.next then break end
				end

				local releatedstr = ''
				if value.last then if releatedstr == '' then releatedstr = "前一個為[[" .. tostring(value.last) .. "]]" end end
				if value.next then 
					if releatedstr ~= '' then releatedstr = releatedstr .. '、'	end 
					releatedstr = releatedstr .. "下一個為[[" .. tostring(value.next) .. "]]"
				end
				if releatedstr ~= '' then value.releatedstr = '。' .. releatedstr else
					value.releatedstr = releatedstr
				end 
				is_checked = true
			end
			if not is_checked then
				if not xpcall(function() check=datainfo.check(self) end,function(_)end) then return value end
			end
			xpcall(function() value=datainfo.value(self, value) end,function(_) end)
			if value.order ~= nil and value.order ~= '' then
				value.orderstr = "第" .. tostring(value.order) .. "個"
			end
			if (value.last ~= nil and value.last ~= '') or (value.next ~= nil and value.next ~= '') then
				local releatedstr = ''
				if value.last then if releatedstr == '' then releatedstr = "前一個為[[" .. tostring(value.last) .. "]]" end end
				if value.next then 
					if releatedstr ~= '' then releatedstr = releatedstr .. '、'	end 
					releatedstr = releatedstr .. "下一個為[[" .. tostring(value.next) .. "]]"
				end
				if releatedstr ~= '' then value.releatedstr = '。' .. releatedstr else
					value.releatedstr = releatedstr
				end 
			end
		end
		return value
	end
	function IntegerInfoPrinter:printInfo(str, propetry)
		local datainfo = p.numberFormat[propetry]
		local body = ''
	
		local check = false
		if datainfo then

			if datainfo.list == nil or (datainfo.list or {})[self.number] == nil then 
				if not xpcall(function() check=datainfo.check(self) end,function(_) check = false end) then end
			else
				if (datainfo.list or {})[self.number] ~= nil then check = true end
			end

			if not check then return '' end
			body = str or ''
			if mw.text.trim(body) == '' then body = datainfo.info end
			if templateParameters._getFormatingStringByArgument == nil then templateParameters = require( 'Module:TemplateParameters' ) end
			body = p._getFormatingStringByArgument(body, {default=datainfo.info})
			local args = self:getValue(propetry)
			--for k,v in pairs(args) do
				body = p._getFormatingStringByArgument(body, args)
			--end
		end
		return body
	end
	return IntegerInfoPrinter;
end

return p