Talk:Numbers with prime digits whose sum is 13: Difference between revisions

m (→‎task wording: added wording.)
 
(4 intermediate revisions by 2 users not shown)
Line 1:
==Nice recursive solution==
Starting with a set N containing the set of prime digits 2,3,5,7:
# add each digit in the set of prime numbers to each digit in N (giving 22,23,..,75,77 first time)
# add any numbers whose digit sum is 13 to the sequence;
# discard all numbers whose digit sum is greater than 11 from N;
# repeat until N is empty.
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:44, 21 October 2020 (UTC)
: Thanks, seems everyone likes that. You can also start with 0 and a simple queue is probably even simpler than recursion. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]])
:: In coder speak a recursive function is a function that can call itself. Mathematically an algorithm is recursive if the output from iteration n of the algorithm is the input to iteration n+1 of the algorithm. In code this can be realized with a loop or in some languages a recursive function, either way the algorithm is mathematically recursive.--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 15:24, 23 January 2023 (UTC)
 
== output from  '''Ring'''  ends too soon ==
 
2,171

edits