Talk:Numbers with prime digits whose sum is 13: Difference between revisions
Talk:Numbers with prime digits whose sum is 13 (view source)
Revision as of 15:24, 23 January 2023
, 1 year ago→Nice recursive solution
m (added a talk section name for the 1st topic (to put the TOC in the proper place).) |
|||
(6 intermediate revisions by 3 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 ==
Line 22 ⟶ 32:
== Thanks ==
Thanks for changing task name.
== task wording ==
Currently: Find all the numbers whose digits are all primes and sum to 13.
How about:
change to: Find all the decimal numbers whose digits are all primes and sum to '''13'''.
<br>or maybe: Find all the numbers (base ten) whose digits are all primes and sum to '''13.'''
:::::::: -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]])
|