Super-d numbers

Revision as of 07:26, 10 October 2019 by Chunes (talk | contribs) (New draft task and Factor entry)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A super-d number is a positive integer n such that d × n^d has at least d consecutive digits d where

Super-d numbers is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
   2 ≤ d ≤ 9

For instance, 753 is a super-3 number because 3 × 753^3 = 1280873331.


Task
  • For d=2 through d=6, show the first 10 super-d numbers.


Extra credit
  • Show the first 10 super-7, super-8, and/or super-9 numbers.   (Optional)


See also


Factor

<lang factor>USING: arrays formatting io kernel lists lists.lazy math math.functions math.ranges math.text.utils prettyprint sequences

IN: rosetta-code.super-d

super-d? ( seq n d -- ? ) tuck ^ * 1 digit-groups subseq? ;
super-d ( d -- list )
   [ dup <array> ] [ drop 1 lfrom ] [ ] tri [ super-d? ] curry
   with lfilter ;
super-d-demo ( -- )
   10 2 6 [a,b] [
       dup "First 10 super-%d numbers:\n" printf
       super-d ltake list>array [ pprint bl ] each nl nl
   ] with each ;

MAIN: super-d-demo</lang>

Output:
First 10 super-2 numbers:
19 31 69 81 105 106 107 119 127 131 

First 10 super-3 numbers:
261 462 471 481 558 753 1036 1046 1471 1645 

First 10 super-4 numbers:
1168 4972 7423 7752 8431 10267 11317 11487 11549 11680 

First 10 super-5 numbers:
4602 5517 7539 12955 14555 20137 20379 26629 32767 35689 

First 10 super-6 numbers:
27257 272570 302693 323576 364509 502785 513675 537771 676657 678146