Talk:Cyclops numbers: Difference between revisions
Content added Content deleted
(Nice recursive solution) |
|||
Line 12: | Line 12: | ||
for n in cP s s output r*n+g |
for n in cP s s output r*n+g |
||
cyclops (r*10) (cP s digits mapped to 10*n+g) |
cyclops (r*10) (cP s digits mapped to 10*n+g) |
||
:Not entirely unlike what bump(half) in the Phix entry does, but then I use left and right to manually step through the product. I guess it could have been clearer if only I had used P(L) and p and l as my "identifiers", when I read the above I cannot help but be reminded of [https://imgur.com/a/fUXHOHH this classic cartoon]. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 17:45, 28 June 2021 (UTC) |
Revision as of 17:46, 28 June 2021
Don't forget that '0' is a Cyclops number
It has an odd number of digits (namely 1) and it's middle (and only) digit is '0'.
It's also classified as such in OEIS A134808 - Cyclops numbers. --PureFox (talk) 09:22, 24 June 2021 (UTC)
- Indeed you are correct. Thanks. --Thundergnat (talk) 10:19, 24 June 2021 (UTC)
Nice recursive solution
The cartesian product cP N G, where N and G are lists of integers, returns a list of tuples (n,g) where n and g are all the members of N and G ordered by n then g. If digits is the list of integers from 1 to 9 then I can define cyclops r s where r is initialized to 100 and s to digits as follows:
for n in cP s s output r*n+g cyclops (r*10) (cP s digits mapped to 10*n+g)
- Not entirely unlike what bump(half) in the Phix entry does, but then I use left and right to manually step through the product. I guess it could have been clearer if only I had used P(L) and p and l as my "identifiers", when I read the above I cannot help but be reminded of this classic cartoon. --Pete Lomax (talk) 17:45, 28 June 2021 (UTC)