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

From Rosetta Code
Content added Content deleted
mNo edit summary
 
(19 intermediate revisions by 7 users not shown)
Line 1: 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 ==

The reference implementation's output (Ring) currently ends at <code>7,222</code>. But there are more unlucky numbers. What about <code>222,223</code>? --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 09:28, 29 September 2020 (UTC)
The reference implementation's output (Ring) currently ends at <code>7,222</code>. But there are more unlucky numbers. What about <code>222,223</code>? --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 09:28, 29 September 2020 (UTC)
: "and sum of them is 13. " --[[User:Horst.h|Horst.h]]
:: ??? Is the sum of the digits of <code>222,223</code> not 13? --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 10:12, 29 September 2020 (UTC)
::: Uups, an unmentioned limit in the program "limit = 10000" that doesn't make sense since 322,222 will be the highest number to test.See also [[Permutations_with_some_identical_elements]].<BR>Maybe a new name for the draft before deletion ;-) --[[User:Horst.h|Horst.h]]

== These are NOT unlucky numbers ==
Unlucky number have a long established definition and this is not it. (See [[oeis:A050505|OEIS A050505]].) These are "Integers in base 10 whose digits are all prime and sum to 13". or perhaps "Unlucky digit sums" My question is: what is the significance of the digits being prime? What property makes these numbers "unlucky"? If it is the summing to 13 why wouldn't <strike>168</strike> 148 be "unlucky"? --[[User:Thundergnat|Thundergnat]] ([[User talk:Thundergnat|talk]]) 10:20, 29 September 2020 (UTC)

== Changes in code ==
I have changed the code and now is the largest Unlucky Number is 322,222 <br>
What do you suggest for new task name?

:I'd just call it 'Numbers with prime digits whose sum is 13'. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 11:02, 29 September 2020 (UTC)

== Change the task name ==
How can I change task name? <br>
If I could not then please change to: <br>
"Numbers with prime digits whose sum is 13"

== Thanks ==
Thanks for changing task name.

== task wording ==
Currently: &nbsp; &nbsp; Find all the numbers whose digits are all primes and sum to 13.

How about:

change to: &nbsp;&nbsp; Find all the decimal numbers whose digits are all primes and sum to '''13'''.
<br>or maybe: &nbsp; &nbsp; 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]])

Latest revision as of 15:24, 23 January 2023

Nice recursive solution

Starting with a set N containing the set of prime digits 2,3,5,7:

  1. add each digit in the set of prime numbers to each digit in N (giving 22,23,..,75,77 first time)
  2. add any numbers whose digit sum is 13 to the sequence;
  3. discard all numbers whose digit sum is greater than 11 from N;
  4. repeat until N is empty.

--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. --Pete Lomax (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.--Nigel Galloway (talk) 15:24, 23 January 2023 (UTC)

output from  Ring  ends too soon

The reference implementation's output (Ring) currently ends at 7,222. But there are more unlucky numbers. What about 222,223? --Chunes (talk) 09:28, 29 September 2020 (UTC)

"and sum of them is 13. " --Horst.h
??? Is the sum of the digits of 222,223 not 13? --Thundergnat (talk) 10:12, 29 September 2020 (UTC)
Uups, an unmentioned limit in the program "limit = 10000" that doesn't make sense since 322,222 will be the highest number to test.See also Permutations_with_some_identical_elements.
Maybe a new name for the draft before deletion ;-) --Horst.h

These are NOT unlucky numbers

Unlucky number have a long established definition and this is not it. (See OEIS A050505.) These are "Integers in base 10 whose digits are all prime and sum to 13". or perhaps "Unlucky digit sums" My question is: what is the significance of the digits being prime? What property makes these numbers "unlucky"? If it is the summing to 13 why wouldn't 168 148 be "unlucky"? --Thundergnat (talk) 10:20, 29 September 2020 (UTC)

Changes in code

I have changed the code and now is the largest Unlucky Number is 322,222
What do you suggest for new task name?

I'd just call it 'Numbers with prime digits whose sum is 13'. --PureFox (talk) 11:02, 29 September 2020 (UTC)

Change the task name

How can I change task name?
If I could not then please change to:
"Numbers with prime digits whose sum is 13"

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.
or maybe:     Find all the numbers (base ten) whose digits are all primes and sum to 13.

-- Gerard Schildberger (talk)