Rhonda numbers: Difference between revisions

Added FreeBASIC
m (Adda related task)
(Added FreeBASIC)
 
(26 intermediate revisions by 15 users not shown)
Line 1:
{{draft task}}
A positive integer '''''n''''' is said to be a Rhonda number to base '''''b''''' if the product of the base '''''b''''' digits of '''''n''''' is equal to '''''b''''' times the sum of '''''n''''''s prime factors.
 
Line 47:
 
 
 
=={{header|ALGOL 68}}==
<syntaxhighlight lang="algol68">
BEGIN # find some Rhonda numbers: numbers n in base b such that the product #
# of the digits of n is b * the sum of the prime factors of n #
 
# returns the sum of the prime factors of n #
PROC factor sum = ( INT n )INT:
BEGIN
INT result := 0;
INT v := ABS n;
WHILE v > 1 AND v MOD 2 = 0 DO
result +:= 2;
v OVERAB 2
OD;
FOR f FROM 3 BY 2 WHILE v > 1 DO
WHILE v > 1 AND v MOD f = 0 DO
result +:= f;
v OVERAB f
OD
OD;
result
END # factor sum # ;
# returns the digit product of n in the specified base #
PROC digit product = ( INT n, base )INT:
IF n = 0 THEN 0
ELSE
INT result := 1;
INT v := ABS n;
WHILE v > 0 DO
result *:= v MOD base;
v OVERAB base
OD;
result
FI # digit product # ;
# returns TRUE if n is a Rhonda number in the specified base, #
# FALSE otherwise #
PROC is rhonda = ( INT n, base )BOOL: base * factor sum( n ) = digit product( n, base );
 
# returns TRUE if n is prime, FALSE otherwise #
PROC is prime = ( INT n )BOOL:
IF n < 3 THEN n = 2
ELIF n MOD 3 = 0 THEN n = 3
ELIF NOT ODD n THEN FALSE
ELSE
INT f := 5;
INT f2 := 25;
INT to next := 24;
BOOL is a prime := TRUE;
WHILE f2 <= n AND is a prime DO
is a prime := n MOD f /= 0;
f +:= 2;
f2 +:= to next;
to next +:= 8
OD;
is a prime
FI # is prime # ;
# returns a string representation of n in the specified base #
PROC to base string = ( INT n, base )STRING:
IF n = 0 THEN "0"
ELSE
INT under 10 = ABS "0";
INT over 9 = ABS "a" - 10;
STRING result := "";
INT v := ABS n;
WHILE v > 0 DO
INT d = v MOD base;
REPR ( d + IF d < 10 THEN under 10 ELSE over 9 FI ) +=: result;
v OVERAB base
OD;
result
FI # to base string # ;
# find the first few Rhonda numbers in non-prime bases 2 .. max base #
INT max rhonda = 10;
INT max base = 16;
FOR base FROM 2 TO max base DO
IF NOT is prime( base ) THEN
print( ( "The first ", whole( max rhonda, 0 )
, " Rhonda numbers in base ", whole( base, 0 )
, ":", newline
)
);
INT r count := 0;
[ 1 : max rhonda ]INT rhonda;
FOR n WHILE r count < max rhonda DO
IF is rhonda( n, base ) THEN
rhonda[ r count +:= 1 ] := n
FI
OD;
print( ( " in base 10:" ) );
FOR i TO max rhonda DO print( ( " ", whole( rhonda[ i ], 0 ) ) ) OD;
print( ( newline ) );
IF base /= 10 THEN
print( ( " in base ", whole( base, -2 ), ":" ) );
FOR i TO max rhonda DO print( ( " ", to base string( rhonda[ i ], base ) ) ) OD;
print( ( newline ) )
FI
FI
OD
END
</syntaxhighlight>
{{out}}
<pre>
The first 10 Rhonda numbers in base 4:
in base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713
in base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221
The first 10 Rhonda numbers in base 6:
in base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992
in base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132
The first 10 Rhonda numbers in base 8:
in base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956
in base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544
The first 10 Rhonda numbers in base 9:
in base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857
in base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376
The first 10 Rhonda numbers in base 10:
in base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985
The first 10 Rhonda numbers in base 12:
in base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849
in base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35
The first 10 Rhonda numbers in base 14:
in base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945
in base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437
The first 10 Rhonda numbers in base 15:
in base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758
in base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8
The first 10 Rhonda numbers in base 16:
in base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070
in base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e
</pre>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">digs: (@`0`..`9`) ++ @`A`..`Z`
toBase: function [n,base][
join map digits.base:base n 'x -> digs\[x]
]
 
rhonda?: function [n,base][
(base * sum factors.prime n) = product digits.base:base n
]
 
nonPrime: select 2..16 'x -> not? prime? x
 
loop nonPrime 'npbase [
print "The first 10 Rhonda numbers, base-" ++ (to :string npbase) ++ ":"
rhondas: select.first:10 1..∞ 'z -> rhonda? z npbase
print ["In base 10 ->" join.with:", " to [:string] rhondas]
print ["In base" npbase "->" join.with:", " to [:string] map rhondas 'w -> toBase w npbase]
print ""
]</syntaxhighlight>
 
{{out}}
 
<pre>The first 10 Rhonda numbers, base-4:
In base 10 -> 10206, 11935, 12150, 16031, 45030, 94185, 113022, 114415, 191149, 244713
In base 4 -> 2133132, 2322133, 2331312, 3322133, 22333212, 112333221, 123211332, 123323233, 232222231, 323233221
 
The first 10 Rhonda numbers, base-6:
In base 10 -> 855, 1029, 3813, 5577, 7040, 7304, 15104, 19136, 35350, 36992
In base 6 -> 3543, 4433, 25353, 41453, 52332, 53452, 153532, 224332, 431354, 443132
 
The first 10 Rhonda numbers, base-8:
In base 10 -> 1836, 6318, 6622, 10530, 14500, 14739, 17655, 18550, 25398, 25956
In base 8 -> 3454, 14256, 14736, 24442, 34244, 34623, 42367, 44166, 61466, 62544
 
The first 10 Rhonda numbers, base-9:
In base 10 -> 15540, 21054, 25331, 44360, 44660, 44733, 47652, 50560, 54944, 76857
In base 9 -> 23276, 31783, 37665, 66758, 67232, 67323, 72326, 76317, 83328, 126376
 
The first 10 Rhonda numbers, base-10:
In base 10 -> 1568, 2835, 4752, 5265, 5439, 5664, 5824, 5832, 8526, 12985
In base 10 -> 1568, 2835, 4752, 5265, 5439, 5664, 5824, 5832, 8526, 12985
 
The first 10 Rhonda numbers, base-12:
In base 10 -> 560, 800, 3993, 4425, 4602, 4888, 7315, 8296, 9315, 11849
In base 12 -> 3A8, 568, 2389, 2689, 27B6, 29B4, 4297, 4974, 5483, 6A35
 
The first 10 Rhonda numbers, base-14:
In base 10 -> 11475, 18655, 20565, 29631, 31725, 45387, 58404, 58667, 59950, 63945
In base 14 -> 4279, 6B27, 76CD, AB27, B7C1, 1277D, 173DA, 17547, 17BC2, 19437
 
The first 10 Rhonda numbers, base-15:
In base 10 -> 2392, 2472, 11468, 15873, 17424, 18126, 19152, 20079, 24388, 30758
In base 15 -> A97, AEC, 35E8, 4A83, 5269, 5586, 5A1C, 5E39, 735D, 91A8
 
The first 10 Rhonda numbers, base-16:
In base 10 -> 1000, 1134, 6776, 15912, 19624, 20043, 20355, 23946, 26296, 29070
In base 16 -> 3E8, 46E, 1A78, 3E28, 4CA8, 4E4B, 4F83, 5D8A, 66B8, 718E</pre>
 
=={{header|C++}}==
<syntaxhighlight lang="cpp">#include <algorithm>
#include <cassert>
#include <iomanip>
#include <iostream>
 
int digit_product(int base, int n) {
int product = 1;
for (; n != 0; n /= base)
product *= n % base;
return product;
}
 
int prime_factor_sum(int n) {
int sum = 0;
for (; (n & 1) == 0; n >>= 1)
sum += 2;
for (int p = 3; p * p <= n; p += 2)
for (; n % p == 0; n /= p)
sum += p;
if (n > 1)
sum += n;
return sum;
}
 
bool is_prime(int n) {
if (n < 2)
return false;
if (n % 2 == 0)
return n == 2;
if (n % 3 == 0)
return n == 3;
for (int p = 5; p * p <= n; p += 4) {
if (n % p == 0)
return false;
p += 2;
if (n % p == 0)
return false;
}
return true;
}
 
bool is_rhonda(int base, int n) {
return digit_product(base, n) == base * prime_factor_sum(n);
}
 
std::string to_string(int base, int n) {
assert(base <= 36);
static constexpr char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::string str;
for (; n != 0; n /= base)
str += digits[n % base];
std::reverse(str.begin(), str.end());
return str;
}
 
int main() {
const int limit = 15;
for (int base = 2; base <= 36; ++base) {
if (is_prime(base))
continue;
std::cout << "First " << limit << " Rhonda numbers to base " << base
<< ":\n";
int numbers[limit];
for (int n = 1, count = 0; count < limit; ++n) {
if (is_rhonda(base, n))
numbers[count++] = n;
}
std::cout << "In base 10:";
for (int i = 0; i < limit; ++i)
std::cout << ' ' << numbers[i];
std::cout << "\nIn base " << base << ':';
for (int i = 0; i < limit; ++i)
std::cout << ' ' << to_string(base, numbers[i]);
std::cout << "\n\n";
}
}</syntaxhighlight>
 
{{out}}
<pre style="height:40ex;">
First 15 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3A8 568 2389 2689 27B6 29B4 4297 4974 5483 6A35 6B64 7662 86B8 8864 94B4
 
First 15 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6B27 76CD AB27 B7C1 1277D 173DA 17547 17BC2 19437 1A873 1B17A 25377 28427 33A75
 
First 15 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: A97 AEC 35E8 4A83 5269 5586 5A1C 5E39 735D 91A8 936A 9BA4 9E1A B385 BA73
 
First 15 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3E8 46E 1A78 3E28 4CA8 4E4B 4F83 5D8A 66B8 718E 7CA2 7E24 85BC 86D9 8E71
 
First 15 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49C 94C 1998 2G9F 35FG 39D4 3B36 3E6G 49F8 64E9 6A6E 77A9 7G19 8696 956D
 
First 15 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4AF 17CA 1I4F 2CI5 2F85 3GF2 465A 46C5 55EC 5A85 6A2J 6DAG 84H5 9G1A A1FC
 
First 15 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3EF C4E J67 189E 1EBC 2EG6 33EC 3E2I 45E9 55I7 5697 6D3E 93J7 9E34 9J37
 
First 15 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5CB 8BE G5B 2FB2 2LB8 3AB4 6GB1 6LBC B16G B1CJ B96A BI78 C7BL G9FB I25B
 
First 15 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3EG 4GL 6LG 9IC 9JG C9G E9G FG6 HCE 16DK 1BGF 1IHG 1LCG 22CI 26EI
 
First 15 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: AKE FA8 L5A 1A5M 3AA7 3H5F 45FF 4AA6 655E 8O55 93F5 95JA A5DO AA2F AEK4
 
First 15 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: BDE DKE DME GD6 16KD 1F6D 1PGD 2E6D 2I2D 2KMD 3ECD 43ED 45KD 64MD 7DIE
 
First 15 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6FI G6I GF9 I2O K9I O9B 169K 19NI 1AII 29JF 2I9J 2Q9I 32IG 337L 339L
 
First 15 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3QE 7BC 7C8 9EE E6G HC7 16LQ 17QQ 18EM 1M67 1MCE 273O 28OE 2AL6 2BEI
 
First 15 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3AO 3FI 5KF 5S6 6IA 7FC 8IA 8P6 9CA AFQ AJ6 AS9 BFA CN5 EEF
 
First 15 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1SO 3GG D6G FG4 GAS GEH OQ2 P4O S8N 1EBG 1GEA 1HOO 1S4S 1VC8 288L
 
First 15 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: MU 6FB 6VB CMW MTF S3M 1LGB 1PBU 1Q3M 3LML 6B78 7BFB 8O2B 9BTG 9JM8
 
First 15 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4UH C8H DHE E8H J6H W4H 36LH 3EHI 3F4H 3HQO 3JEH 4H6E 6CSH 6H28 7HOI
 
First 15 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6P7 7PQ 7U8 F7E P9E Y7A 17LU 17SA 1BFE 1FL7 1FPL 1J5E 2A7F 2DEF 2EBK
 
First 15 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: RS 3PC 4DI 6BI 8HI 9KS A9G C5I CZ9 HRC 13TO 14OU 1G9S 1IQ9 1LW6
 
</pre>
 
=={{header|Factor}}==
{{works with|Factor|0.99 2022-04-03}}
<syntaxhighlight lang="factor">USING: formatting grouping io kernel lists lists.lazy math
math.parser math.primes math.primes.factors prettyprint ranges
sequences sequences.extras ;
 
: rhonda? ( n base -- ? )
[ [ >base 1 group ] keep '[ _ base> ] map-product ]
[ swap factors sum * ] 2bi = ;
 
: rhonda ( base -- list ) 1 lfrom swap '[ _ rhonda? ] lfilter ;
 
: list. ( list base -- ) '[ _ >base write bl ] leach nl ;
 
:: rhonda. ( base -- )
15 base rhonda ltake :> r
base "First 15 Rhonda numbers to base %d:\n" printf
"In base 10: " write r 10 list.
base "In base %d: " printf r base list. ;
 
2 36 [a..b] [ prime? not ] filter [ rhonda. nl ] each</syntaxhighlight>
{{out}}
<pre style="height:40ex">
First 15 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
</pre>
 
=={{header|FreeBASIC}}==
{{trans|ALGOL 68}}
<syntaxhighlight lang="vbnet">'#include "isprime.bas"
 
Function FactorSum(n As Uinteger) As Uinteger
Dim As Uinteger result = 0
Dim As Uinteger v = Abs(n)
While v > 1 And v Mod 2 = 0
result += 2
v \= 2
Wend
For f As Uinteger = 3 To v Step 2
While v > 1 And v Mod f = 0
result += f
v \= f
Wend
Next f
Return result
End Function
 
Function DigitProduct(n As Uinteger, base_ As Uinteger) As Uinteger
If n = 0 Then Return 0
Dim As Uinteger result = 1
Dim As Uinteger v = Abs(n)
While v > 0
result *= v Mod base_
v \= base_
Wend
Return result
End Function
 
Function isRhonda(n As Uinteger, base_ As Uinteger) As Uinteger
Return base_ * FactorSum(n) = DigitProduct(n, base_)
End Function
 
Function ToBaseString(n As Uinteger, base_ As Uinteger) As String
If n = 0 Then Return "0"
Dim As Uinteger under10 = Asc("0")
Dim As Uinteger over9 = Asc("a") - 10
Dim As String result = ""
Dim As Uinteger v = Abs(n)
While v > 0
Dim As Uinteger d = v Mod base_
result = Chr(d + Iif(d < 10, under10, over9)) + result
v \= base_
Wend
Return result
End Function
 
Dim As Uinteger maxRhonda = 10, maxBase = 16
For base_ As Uinteger = 2 To maxBase
If Not isPrime(base_) Then
Print "The first "; maxRhonda; " Rhonda numbers in base "; base_; ":"
Dim As Uinteger rCount = 0
Dim As Uinteger rhonda(1 To maxRhonda)
Dim As Uinteger n = 1
While rCount < maxRhonda
If isRhonda(n, base_) Then
rCount += 1
rhonda(rCount) = n
End If
n += 1
Wend
Print " in base 10: ";
For i As Uinteger = 1 To maxRhonda
Print " "; rhonda(i);
Next i
Print
If base_ <> 10 Then
Print Using " in base ##: "; base_;
For i As Uinteger = 1 To maxRhonda
Print " "; ToBaseString(rhonda(i), base_);
Next i
Print
End If
End If
Next base_
 
Sleep</syntaxhighlight>
{{out}}
<pre>Same as ALGOL 68 entry.</pre>
 
=={{header|Go}}==
{{trans|Wren}}
{{libheader|Go-rcu}}
<syntaxhighlight lang="go">package main
 
import (
"fmt"
"rcu"
"strconv"
)
 
func contains(a []int, n int) bool {
for _, e := range a {
if e == n {
return true
}
}
return false
}
 
func main() {
for b := 2; b <= 36; b++ {
if rcu.IsPrime(b) {
continue
}
count := 0
var rhonda []int
for n := 1; count < 15; n++ {
digits := rcu.Digits(n, b)
if !contains(digits, 0) {
var anyEven = false
for _, d := range digits {
if d%2 == 0 {
anyEven = true
break
}
}
if b != 10 || (contains(digits, 5) && anyEven) {
calc1 := 1
for _, d := range digits {
calc1 *= d
}
calc2 := b * rcu.SumInts(rcu.PrimeFactors(n))
if calc1 == calc2 {
rhonda = append(rhonda, n)
count++
}
}
}
}
if len(rhonda) > 0 {
fmt.Printf("\nFirst 15 Rhonda numbers in base %d:\n", b)
rhonda2 := make([]string, len(rhonda))
counts2 := make([]int, len(rhonda))
for i, r := range rhonda {
rhonda2[i] = fmt.Sprintf("%d", r)
counts2[i] = len(rhonda2[i])
}
rhonda3 := make([]string, len(rhonda))
counts3 := make([]int, len(rhonda))
for i, r := range rhonda {
rhonda3[i] = strconv.FormatInt(int64(r), b)
counts3[i] = len(rhonda3[i])
}
maxLen2 := rcu.MaxInts(counts2)
maxLen3 := rcu.MaxInts(counts3)
maxLen := maxLen2
if maxLen3 > maxLen {
maxLen = maxLen3
}
maxLen++
fmt.Printf("In base 10: %*s\n", maxLen, rhonda2)
fmt.Printf("In base %-2d: %*s\n", b, maxLen, rhonda3)
}
}
}</syntaxhighlight>
 
{{out}}
<pre style="height:40ex;overflow:scroll;">
First 15 Rhonda numbers in base 4:
In base 10: [ 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902]
In base 4 : [ 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232]
 
First 15 Rhonda numbers in base 6:
In base 10: [ 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821]
In base 6 : [ 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553]
 
First 15 Rhonda numbers in base 8:
In base 10: [ 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429]
In base 8 : [ 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345]
 
First 15 Rhonda numbers in base 9:
In base 10: [ 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944]
In base 9 : [ 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316]
 
First 15 Rhonda numbers in base 10:
In base 10: [ 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662]
In base 10: [ 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662]
 
First 15 Rhonda numbers in base 12:
In base 10: [ 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264]
In base 12: [ 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4]
 
First 15 Rhonda numbers in base 14:
In base 10: [ 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543]
In base 14: [ 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75]
 
First 15 Rhonda numbers in base 15:
In base 10: [ 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483]
In base 15: [ a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73]
 
First 15 Rhonda numbers in base 16:
In base 10: [ 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465]
In base 16: [ 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71]
 
First 15 Rhonda numbers in base 18:
In base 10: [ 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229]
In base 18: [ 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d]
 
First 15 Rhonda numbers in base 20:
In base 10: [ 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712]
In base 20: [ 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc]
 
First 15 Rhonda numbers in base 21:
In base 10: [ 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798]
In base 21: [ 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37]
 
First 15 Rhonda numbers in base 22:
In base 10: [ 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753]
In base 22: [ 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b]
 
First 15 Rhonda numbers in base 24:
In base 10: [ 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458]
In base 24: [ 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei]
 
First 15 Rhonda numbers in base 25:
In base 10: [ 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504]
In base 25: [ ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4]
 
First 15 Rhonda numbers in base 26:
In base 10: [ 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302]
In base 26: [ bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die]
 
First 15 Rhonda numbers in base 27:
In base 10: [ 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500]
In base 27: [ 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l]
 
First 15 Rhonda numbers in base 28:
In base 10: [ 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938]
In base 28: [ 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei]
 
First 15 Rhonda numbers in base 30:
In base 10: [ 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035]
In base 30: [ 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef]
 
First 15 Rhonda numbers in base 32:
In base 10: [ 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005]
In base 32: [ 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l]
 
First 15 Rhonda numbers in base 33:
In base 10: [ 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858]
In base 33: [ mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8]
 
First 15 Rhonda numbers in base 34:
In base 10: [ 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614]
In base 34: [ 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi]
 
First 15 Rhonda numbers in base 35:
In base 10: [ 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305]
In base 35: [ 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk]
 
First 15 Rhonda numbers in base 36:
In base 10: [ 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030]
In base 36: [ rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6]
</pre>
 
=={{header|J}}==
 
<syntaxhighlight lang="j">tobase=: (a.{~;48 97(+ i.)each 10 26) {~ #.inv
isrhonda=: (*/@:(#.inv) = (* +/@q:))"0
 
task=: {{
for_base.(#~ 0=1&p:) }.1+i.36 do.
k=.i.0
block=. 1+i.1e4
while. 15>#k do.
k=. k, block#~ base isrhonda block
block=. block+1e4
end.
echo ''
echo 'First 15 Rhondas in',b=.' base ',':',~":base
echo 'In base 10: ',":15{.k
echo 'In',;:inv b;base tobase each 15{.k
end.
}}
 
task''
</syntaxhighlight>
{{out}}
<pre style="height:40ex;overflow:scroll;">
First 15 Rhondas in base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhondas in base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhondas in base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhondas in base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhondas in base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhondas in base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhondas in base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhondas in base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhondas in base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhondas in base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhondas in base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhondas in base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhondas in base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhondas in base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhondas in base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhondas in base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhondas in base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhondas in base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhondas in base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhondas in base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhondas in base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhondas in base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhondas in base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhondas in base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
</pre>
 
=={{header|Hoon}}==
 
Library file (e.g. <code>/lib/rhonda.hoon</code>):
 
<syntaxhighlight lang="hoon">::
:: A library for producing Rhonda numbers and testing if numbers are Rhonda.
::
:: A number is Rhonda if the product of its digits of in base b equals
:: the product of the base b and the sum of its prime factors.
:: see also: https://mathworld.wolfram.com/RhondaNumber.html
::
=<
::
|%
:: +check: test whether the number n is Rhonda to base b
::
++ check
|= [b=@ud n=@ud]
^- ?
~_ leaf+"base b must be >= 2"
?> (gte b 2)
~_ leaf+"candidate number n must be >= 2"
?> (gte n 2)
::
.= (roll (base-digits b n) mul)
%+ mul
b
(roll (prime-factors n) add)
:: +series: produce the first n numbers which are Rhonda in base b
::
:: produce ~ if base b has no Rhonda numbers
::
++ series
|= [b=@ud n=@ud]
^- (list @ud)
~_ leaf+"base b must be >= 2"
?> (gte b 2)
::
?: =((prime-factors b) ~[b])
~
=/ candidate=@ud 2
=+ rhondas=*(list @ud)
|-
?: =(n 0)
(flop rhondas)
=/ is-rhonda=? (check b candidate)
%= $
rhondas ?:(is-rhonda [candidate rhondas] rhondas)
n ?:(is-rhonda (dec n) n)
candidate +(candidate)
==
--
::
|%
:: +base-digits: produce a list of the digits of n represented in base b
::
:: This arm has two behaviors which may be at first surprising, but do not
:: matter for the purposes of the ++check and ++series arms, and allow for
:: some simplifications to its implementation.
:: - crashes on n=0
:: - orders the list of digits with least significant digits first
::
:: ex: (base-digits 4 10.206) produces ~[2 3 1 3 3 1 2]
::
++ base-digits
|= [b=@ud n=@ud]
^- (list @ud)
?> (gte b 2)
?< =(n 0)
::
|-
?: =(n 0)
~
:- (mod n b)
$(n (div n b))
:: +prime-factors: produce a list of the prime factors of n
::
:: by trial division
:: n must be >= 2
:: if n is prime, produce ~[n]
:: ex: (prime-factors 10.206) produces ~[7 3 3 3 3 3 3 2]
::
++ prime-factors
|= [n=@ud]
^- (list @ud)
?> (gte n 2)
::
=+ factors=*(list @ud)
=/ wheel new-wheel
:: test candidates as produced by the wheel, not exceeding sqrt(n)
::
|-
=^ candidate wheel (next:wheel)
?. (lte (mul candidate candidate) n)
?:((gth n 1) [n factors] factors)
|-
?: =((mod n candidate) 0)
:: repeat the prime factor as many times as possible
::
$(factors [candidate factors], n (div n candidate))
^$
:: +new-wheel: a door for generating numbers that may be prime
::
:: This uses wheel factorization with a basis of {2, 3, 5} to limit the
:: number of composites produced. It produces numbers in increasing order
:: starting from 2.
::
++ new-wheel
=/ fixed=(list @ud) ~[2 3 5 7]
=/ skips=(list @ud) ~[4 2 4 2 4 6 2 6]
=/ lent-fixed=@ud (lent fixed)
=/ lent-skips=@ud (lent skips)
::
|_ [current=@ud fixed-i=@ud skips-i=@ud]
:: +next: produce the next number and the new wheel state
::
++ next
|.
:: Exhaust the numbers in fixed. Then calculate successive values by
:: cycling through skips and increasing from the previous number by
:: the current skip-value.
::
=/ fixed-done=? =(fixed-i lent-fixed)
=/ next-fixed-i ?:(fixed-done fixed-i +(fixed-i))
=/ next-skips-i ?:(fixed-done (mod +(skips-i) lent-skips) skips-i)
=/ next
?. fixed-done
(snag fixed-i fixed)
(add current (snag skips-i skips))
:- next
+.$(current next, fixed-i next-fixed-i, skips-i next-skips-i)
--
--</syntaxhighlight>
 
Script file ("generator") (e.g. <code>/gen/rhonda.hoon</code>):
 
<syntaxhighlight lang="hoon">/+ *rhonda
:- %say
|= [* [base=@ud many=@ud ~] ~]
:- %noun
(series base many)</syntaxhighlight>
 
Alternative library file using <code>map</code> (associative array):
 
<syntaxhighlight lang="hoon">|%
++ check
|= [n=@ud base=@ud]
:: if base is prime, automatic no
::
?: =((~(gut by (prime-map +(base))) base 0) 0)
%.n
:: if not multiply the digits and compare to base x sum of factors
::
?: =((roll (digits [base n]) mul) (mul base (roll (factor n) add)))
%.y
%.n
++ series
|= [base=@ud many=@ud]
=/ rhondas *(list @ud)
?: =((~(gut by (prime-map +(base))) base 0) 0)
rhondas
=/ itr 1
|-
?: =((lent rhondas) many)
(flop rhondas)
?: =((check itr base) %.n)
$(itr +(itr))
$(rhondas [itr rhondas], itr +(itr))
:: digits: gives the list of digits of a number in a base
::
:: We strip digits least to most significant.
:: The least significant digit (lsd) of n in base b is just n mod b.
:: Subtract the lsd, divide by b, and repeat.
:: To know when to stop, we need to know how many digits there are.
++ digits
|= [base=@ud num=@ud]
^- (list @ud)
|-
=/ modulus=@ud (mod num base)
?: =((num-digits base num) 1)
~[modulus]
[modulus $(num (div (sub num modulus) base))]
:: num-digits: gives the number of digits of a number in a base
::
:: Simple idea: k is the number of digits of n in base b if and
:: only if k is the smallest number such that b^k > n.
++ num-digits
|= [base=@ud num=@ud]
^- @ud
=/ digits=@ud 1
|-
?: (gth (pow base digits) num)
digits
$(digits +(digits))
:: factor: produce a list of prime factors
::
:: The idea is to identify "small factors" of n, i.e. prime factors less than
:: the square root. We then divide n by these factors to reduce the
:: magnitude of n. It's easy to argue that after this is done, we obtain 1
:: or the largest prime factor.
::
++ factor
|= n=@ud
^- (list @ud)
?: ?|(=(n 0) =(n 1))
~[n]
=/ factorization *(list @ud)
:: produce primes less than or equal to root n
::
=/ root (sqrt n)
=/ primes (prime-map +(root))
:: itr = iterate; we want to iterate through the primes less than root n
::
=/ itr 2
|-
?: =(itr +(root))
:: if n is now 1 we're done
::
?: =(n 1)
factorization
:: otherwise it's now the original n's largest primes factor
::
[n factorization]
:: if itr not prime move on
::
?: =((~(gut by primes) itr 0) 1)
$(itr +(itr))
:: if it is prime, divide out by the highest power that divides num
::
?: =((mod n itr) 0)
$(n (div n itr), factorization [itr factorization])
:: once done, move to next prime
::
$(itr +(itr))
:: sqrt: gives the integer square root of a number
::
:: It's based on an algorithm that predates the Greeks:
:: To find the square root of A, think of A as an area.
:: Guess the side of the square x. Compute the other side y = A/x.
:: If x is an over/underestimate then y is an under/overestimate.
:: So (x+y)/2 is the average of an over and underestimate, thus better than x.
:: Repeatedly doing x --> (x + A/x)/2 converges to sqrt(A).
::
:: This algorithm is the same but with integer valued operations.
:: The algorithm either converges to the integer square root and repeats,
:: or gets trapped in a two-cycle of adjacent integers.
:: In the latter case, the smaller number is the answer.
::
++ sqrt
|= n=@ud
=/ guess=@ud 1
|-
=/ new-guess (div (add guess (div n guess)) 2)
:: sequence stabilizes
::
?: =(guess new-guess)
guess
:: sequence is trapped in 2-cycle
::
?: =(guess +(new-guess))
new-guess
?: =(new-guess +(guess))
guess
$(guess new-guess)
:: prime-map: (effectively) produces primes less than a given input
::
:: This is the sieve of Eratosthenes to produce primes less than n.
:: I used a map because it had much faster performance than a list.
:: Any key in the map is a non-prime. The value 1 indicates "false."
:: I.e. it's not a prime.
++ prime-map
|= n=@ud
^- (map @ud @ud)
=/ prime-map `(map @ud @ud)`(my ~[[0 1] [1 1]])
:: start sieving with 2
::
=/ sieve 2
|-
:: if sieve is too large to be a factor we're done
::
?: (gte (mul sieve sieve) n)
prime-map
:: if not too large but not prime, move on
::
?: =((~(gut by prime-map) sieve 0) 1)
$(sieve +(sieve))
:: sequence: explanation
::
:: If s is the sieve number, we start sieving multiples
:: of s at s^2 in sequence: s^2, s^2 + s, s^2 + 2s, ...
:: We start at s^2 because any number smaller than s^2
:: has prime factors less than s and would have been
:: eliminated earlier in the sieving process.
::
=/ sequence (mul sieve sieve)
|-
:: done sieving with s once sequence is past n
::
?: (gte sequence n)
^$(sieve +(sieve))
:: if sequence position is known not prime we move on
::
?: =((~(gut by prime-map) sequence 0) 1)
$(sequence (add sequence sieve))
:: otherwise we mark position of sequence as not prime and move on
::
$(prime-map (~(put by prime-map) sequence 1), sequence (add sequence sieve))
--</syntaxhighlight>
 
=={{header|Java}}==
<syntaxhighlight lang="java">public class RhondaNumbers {
public static void main(String[] args) {
final int limit = 15;
for (int base = 2; base <= 36; ++base) {
if (isPrime(base))
continue;
System.out.printf("First %d Rhonda numbers to base %d:\n", limit, base);
int numbers[] = new int[limit];
for (int n = 1, count = 0; count < limit; ++n) {
if (isRhonda(base, n))
numbers[count++] = n;
}
System.out.printf("In base 10:");
for (int i = 0; i < limit; ++i)
System.out.printf(" %d", numbers[i]);
System.out.printf("\nIn base %d:", base);
for (int i = 0; i < limit; ++i)
System.out.printf(" %s", Integer.toString(numbers[i], base));
System.out.printf("\n\n");
}
}
private static int digitProduct(int base, int n) {
int product = 1;
for (; n != 0; n /= base)
product *= n % base;
return product;
}
private static int primeFactorSum(int n) {
int sum = 0;
for (; (n & 1) == 0; n >>= 1)
sum += 2;
for (int p = 3; p * p <= n; p += 2)
for (; n % p == 0; n /= p)
sum += p;
if (n > 1)
sum += n;
return sum;
}
private static boolean isPrime(int n) {
if (n < 2)
return false;
if (n % 2 == 0)
return n == 2;
if (n % 3 == 0)
return n == 3;
for (int p = 5; p * p <= n; p += 4) {
if (n % p == 0)
return false;
p += 2;
if (n % p == 0)
return false;
}
return true;
}
private static boolean isRhonda(int base, int n) {
return digitProduct(base, n) == base * primeFactorSum(n);
}
}</syntaxhighlight>
 
{{out}}
<pre style="height:40ex;">
First 15 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
 
</pre>
 
=={{header|jq}}==
'''Works with jq and gojq, that is, the C and Go implementations of jq.'''
 
'''Adapted from [[#Wren|Wren]]'''
 
'''Generic stream-oriented utility functions'''
<syntaxhighlight lang=jq>
def prod(s): reduce s as $_ (1; . * $_);
 
def sigma(s): reduce s as $_ (0; . + $_);
 
# If s is a stream of JSON entities that does not include null, butlast(s) emits all but the last.
def butlast(s):
label $out
| foreach (s,null) as $x ({};
if $x == null then break $out else .emit = .prev | .prev = $x end)
| select(.emit).emit;
 
def multiple(s):
first(foreach s as $x (0; .+1; select(. > 1))) // false;
 
# Output: a stream of the prime factors of the input
# e.g.
# 2 | factors #=> 2
# 24 | factors #=> 2 2 2 3
def factors:
. as $in
| [2, $in, false]
| recurse(
. as [$p, $q, $valid, $s]
| if $q == 1 then empty
elif $q % $p == 0 then [$p, $q/$p, true]
elif $p == 2 then [3, $q, false, $s]
else ($s // ($q | sqrt)) as $s
| if $p + 2 <= $s then [$p + 2, $q, false, $s]
else [$q, 1, true]
end
end )
| if .[2] then .[0] else empty end ;
</syntaxhighlight>
'''Other generic functions'''
<syntaxhighlight lang=jq>
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;
 
def is_prime:
multiple(factors) | not;
def tobase($b):
def digit: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[.:.+1];
def mod: . % $b;
def div: ((. - mod) / $b);
def digits: recurse( select(. > 0) | div) | mod ;
# For jq it would be wise to protect against `infinite` as input, but using `isinfinite` confuses gojq
select( (tostring|test("^[0-9]+$")) and 2 <= $b and $b <= 36)
| if . == 0 then "0"
else [digits | digit] | reverse[1:] | add
end;
 
# emit the decimal values of the "digits"
def digits($b):
def mod: . % $b;
def div: ((. - mod) / $b);
butlast(recurse( select(. > 0) | div) | mod) ;
</syntaxhighlight>
'''Rhonda numbers'''
<syntaxhighlight lang=jq>
# Emit a stream of Rhonda numbers in the given base
def rhondas($b):
range(1; infinite) as $n
| ($n | [digits($b)]) as $digits
| select($digits|index(0)|not)
| select(($b != 10) or (($digits|index(5)) and ($digits | any(. % 2 == 0))))
| select(prod($digits[]) == ($b * sigma($n | factors)))
| $n ;
</syntaxhighlight>
'''The task'''
<syntaxhighlight lang=jq>
def task($count):
range (2; 37) as $b
| select( $b | is_prime | not)
| [ limit($count; rhondas($b)) ]
| select(length > 0)
|"First \($count) Rhonda numbers in base \($b):",
( (map(tostring)) as $rhonda2
| (map(tobase($b))) as $rhonda3
| (($rhonda2|map(length)) | max) as $maxLen2
| (($rhonda3|map(length)) | max) as $maxLen3
| ( ([$maxLen2, $maxLen3]|max) + 1) as $maxLen
| "In base 10: \($rhonda2 | map(lpad($maxLen)) | join(" ") )",
"In base \($b|lpad(2)): \($rhonda3 | map(lpad($maxLen)) | join(" ") )",
"") ;
 
task(10)
</syntaxhighlight>
{{output}}
<pre>
First 10 Rhonda numbers in base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221
 
First 10 Rhonda numbers in base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132
 
First 10 Rhonda numbers in base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544
 
First 10 Rhonda numbers in base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376
 
First 10 Rhonda numbers in base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985
 
First 10 Rhonda numbers in base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849
In base 12: 3A8 568 2389 2689 27B6 29B4 4297 4974 5483 6A35
 
First 10 Rhonda numbers in base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945
In base 14: 4279 6B27 76CD AB27 B7C1 1277D 173DA 17547 17BC2 19437
 
First 10 Rhonda numbers in base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758
In base 15: A97 AEC 35E8 4A83 5269 5586 5A1C 5E39 735D 91A8
 
First 10 Rhonda numbers in base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070
In base 16: 3E8 46E 1A78 3E28 4CA8 4E4B 4F83 5D8A 66B8 718E
 
First 10 Rhonda numbers in base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549
In base 18: 49C 94C 1998 2G9F 35FG 39D4 3B36 3E6G 49F8 64E9
 
First 10 Rhonda numbers in base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165
In base 20: 4AF 17CA 1I4F 2CI5 2F85 3GF2 465A 46C5 55EC 5A85
 
First 10 Rhonda numbers in base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895
In base 21: 3EF C4E J67 189E 1EBC 2EG6 33EC 3E2I 45E9 55I7
 
First 10 Rhonda numbers in base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895
In base 22: 5CB 8BE G5B 2FB2 2LB8 3AB4 6GB1 6LBC B16G B1CJ
 
First 10 Rhonda numbers in base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612
In base 24: 3EG 4GL 6LG 9IC 9JG C9G E9G FG6 HCE 16DK
 
First 10 Rhonda numbers in base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130
In base 25: AKE FA8 L5A 1A5M 3AA7 3H5F 45FF 4AA6 655E 8O55
 
First 10 Rhonda numbers in base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257
In base 26: BDE DKE DME GD6 16KD 1F6D 1PGD 2E6D 2I2D 2KMD
 
First 10 Rhonda numbers in base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455
In base 27: 6FI G6I GF9 I2O K9I O9B 169K 19NI 1AII 29JF
 
First 10 Rhonda numbers in base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375
In base 28: 3QE 7BC 7C8 9EE E6G HC7 16LQ 17QQ 18EM 1M67
 
First 10 Rhonda numbers in base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476
In base 30: 3AO 3FI 5KF 5S6 6IA 7FC 8IA 8P6 9CA AFQ
 
First 10 Rhonda numbers in base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472
In base 32: 1SO 3GG D6G FG4 GAS GEH OQ2 P4O S8N 1EBG
 
First 10 Rhonda numbers in base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427
In base 33: MU 6FB 6VB CMW MTF S3M 1LGB 1PBU 1Q3M 3LML
 
First 10 Rhonda numbers in base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472
In base 34: 4UH C8H DHE E8H J6H W4H 36LH 3EHI 3F4H 3HQO
 
First 10 Rhonda numbers in base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992
In base 35: 6P7 7PQ 7U8 F7E P9E Y7A 17LU 17SA 1BFE 1FL7
 
First 10 Rhonda numbers in base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016
In base 36: RS 3PC 4DI 6BI 8HI 9KS A9G C5I CZ9 HRC
</pre>
 
=={{header|Julia}}==
<langsyntaxhighlight lang="julia">using Primes
 
isRhonda(n, b) = prod(digits(n, base=b)) == b * sum([prod(pair) for pair in factor(n).pe])
Line 67 ⟶ 1,598:
 
displayrhondas(2, 16, 15)
</langsyntaxhighlight>{{out}}
<pre style="height:40ex;overflow:scroll;">
<pre>
First 15 Rhondas in base 4:
In base 10: [10206, 11935, 12150, 16031, 45030, 94185, 113022, 114415, 191149, 244713, 259753, 374782, 392121, 503773, 649902]
Line 106 ⟶ 1,637:
</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">ClearAll[RhondaNumberQ]
RhondaNumberQ[b_Integer][n_Integer] := Module[{l, r},
l = Times @@ IntegerDigits[n, b];
r = Total[Catenate[ConstantArray @@@ FactorInteger[n]]];
l == b r
]
bases = Select[Range[2, 36], PrimeQ/*Not];
Do[
Print["base ", b, ":", Take[Select[Range[700000], RhondaNumberQ[b]], UpTo[15]]];
,
{b, bases}
]</syntaxhighlight>
{{out}}
<pre>base 4:{10206,11935,12150,16031,45030,94185,113022,114415,191149,244713,259753,374782,392121,503773,649902}
base 6:{855,1029,3813,5577,7040,7304,15104,19136,35350,36992,41031,42009,60368,65536,67821}
base 8:{1836,6318,6622,10530,14500,14739,17655,18550,25398,25956,30562,39215,39325,50875,51429}
base 9:{15540,21054,25331,44360,44660,44733,47652,50560,54944,76857,77142,83334,83694,96448,97944}
base 10:{1568,2835,4752,5265,5439,5664,5824,5832,8526,12985,15625,15698,19435,25284,25662}
base 12:{560,800,3993,4425,4602,4888,7315,8296,9315,11849,12028,13034,14828,15052,16264}
base 14:{11475,18655,20565,29631,31725,45387,58404,58667,59950,63945,67525,68904,91245,99603,125543}
base 15:{2392,2472,11468,15873,17424,18126,19152,20079,24388,30758,31150,33004,33550,37925,39483}
base 16:{1000,1134,6776,15912,19624,20043,20355,23946,26296,29070,31906,32292,34236,34521,36465}
base 18:{1470,3000,8918,17025,19402,20650,21120,22156,26522,36549,38354,43281,46035,48768,54229}
base 20:{1815,11050,15295,21165,22165,30702,34510,34645,42292,44165,52059,53416,65945,78430,80712}
base 21:{1632,5390,8512,12992,15678,25038,29412,34017,39552,48895,49147,61376,85078,89590,91798}
base 22:{2695,4128,7865,28800,31710,37030,71875,74306,117760,117895,121626,126002,131427,175065,192753}
base 24:{2080,2709,3976,5628,5656,7144,8296,9030,10094,17612,20559,24616,26224,29106,31458}
base 25:{6764,9633,13260,22022,53382,57640,66015,69006,97014,140130,142880,144235,159724,162565,165504}
base 26:{7788,9322,9374,11160,22165,27885,34905,44785,47385,49257,62517,72709,74217,108745,132302}
base 27:{4797,11844,12078,13200,14841,17750,24320,26883,27477,46455,52750,58581,61009,61446,61500}
base 28:{3094,5808,5832,7462,11160,13671,27270,28194,28638,39375,39550,49500,50862,52338,52938}
base 30:{3024,3168,5115,5346,5950,6762,7750,7956,8470,9476,9576,9849,10360,11495,13035}
base 32:{1944,3600,13520,15876,16732,16849,25410,25752,28951,47472,49610,50968,61596,64904,74005}
base 33:{756,7040,7568,13826,24930,30613,59345,63555,64372,131427,227840,264044,313709,336385,344858}
base 34:{5661,14161,15620,16473,22185,37145,125579,134692,135405,138472,140369,177086,250665,255552,295614}
base 35:{8232,9476,9633,18634,30954,41905,52215,52440,56889,61992,62146,66339,98260,102180,103305}
base 36:{1000,4800,5670,8190,10998,12412,13300,15750,16821,23016,51612,52734,67744,70929,75030}</pre>
 
=={{header|Nim}}==
<syntaxhighlight lang="Nim">import std/[sequtils, strformat, strutils]
 
type Base = 2..36
 
template isEven(n: int): bool = (n and 1) == 0
 
func isPrime(n: Natural): bool =
## Return true if "n" is prime.
if n < 2: return false
if n.isEven: return n == 2
if n mod 3 == 0: return n == 3
var d = 5
while d * d <= n:
if n mod d == 0: return false
inc d, 2
return true
 
func digitProduct(n: Positive; base: Base): int =
## Return the product of digits of "n" in given base.
var n = n.Natural
result = 1
while n != 0:
result *= n mod base
n = n div base
 
func primeFactorSum(n: Positive): int =
## Return the sum of prime factors of "n".
var n = n.Natural
while n.isEven:
inc result, 2
n = n shr 1
var d = 3
while d * d <= n:
while n mod d == 0:
inc result, d
n = n div d
inc d, 2
if n > 1: inc result, n
 
func isRhondaNumber(n: Positive; base: Base): bool =
## Return true if "n" is a Rhonda number to given base.
n.digitProduct(base) == base * n.primeFactorSum
 
const Digits = toSeq('0'..'9') & toSeq('a'..'z')
 
func toBase(n: Positive; base: Base): string =
## Return the string representation of "n" in given base.
var n = n.Natural
while true:
result.add Digits[n mod base]
n = n div base
if n == 0: break
# Reverse the digits.
for i in 1..(result.len shr 1):
swap result[i - 1], result[^i]
 
 
const N = 10
 
for base in 2..36:
if base.isPrime: continue
echo &"First {N} Rhonda numbers to base {base}:"
var rhondaList: seq[Positive]
var n = 1
var count = 0
while count < N:
if n.isRhondaNumber(base):
rhondaList.add n
inc count
inc n
echo "In base 10: ", rhondaList.join(" ")
echo &"In base {base}: ", rhondaList.mapIt(it.toBase(base)).join(" ")
echo()
</syntaxhighlight>
 
{{out}}
<pre>First 10 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221
 
First 10 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132
 
First 10 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544
 
First 10 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376
 
First 10 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985
 
First 10 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35
 
First 10 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437
 
First 10 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8
 
First 10 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e
 
First 10 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9
 
First 10 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85
 
First 10 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7
 
First 10 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj
 
First 10 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk
 
First 10 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55
 
First 10 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd
 
First 10 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf
 
First 10 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67
 
First 10 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq
 
First 10 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg
 
First 10 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml
 
First 10 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo
 
First 10 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7
 
First 10 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc
</pre>
 
=={{header|PARI/GP}}==
{{trans|Julia}}
<syntaxhighlight lang="PARI/GP">
isRhonda(n, b) =
{
local(mydigits, product, mysum, factors, pairProduct);
mydigits = digits(n, b);
product = vecprod(mydigits);
factors = factor(n);
mysum= 0;
for(i = 1, matsize(factors)[1],
pairProduct = factors[i, 1] * factors[i, 2];
mysum += pairProduct;
);
product == b * mysum;
}
 
displayrhondas(low, high, nshow) =
{
local(b, n, rhondas, count, basebRhondas);
for(b = low, high,
if(isprime(b), next);
n = 1; rhondas = [];
count = 0;
while(count < nshow,
if(isRhonda(n, b),
rhondas = concat(rhondas, n);
count++;
);
n++;
);
print("First " nshow " Rhondas in base " b ":");
print("In base 10: " rhondas);
basebRhondas = vector(#rhondas, i, (digits(rhondas[i], b)));
print("In base " b ": " basebRhondas);
print("\n");
);
}
 
displayrhondas(2, 16, 15);
</syntaxhighlight>
{{out}}
<pre style="height:40ex;overflow:scroll;">
First 15 Rhondas in base 4:
In base 10: [10206, 11935, 12150, 16031, 45030, 94185, 113022, 114415, 191149, 244713, 259753, 374782, 392121, 503773, 649902]
In base 4: [[2, 1, 3, 3, 1, 3, 2], [2, 3, 2, 2, 1, 3, 3], [2, 3, 3, 1, 3, 1, 2], [3, 3, 2, 2, 1, 3, 3], [2, 2, 3, 3, 3, 2, 1, 2], [1, 1, 2, 3, 3, 3, 2, 2, 1], [1, 2, 3, 2, 1, 1, 3, 3, 2], [1, 2, 3, 3, 2, 3, 2, 3, 3], [2, 3, 2, 2, 2, 2, 2, 3, 1], [3, 2, 3, 2, 3, 3, 2, 2, 1], [3, 3, 3, 1, 2, 2, 2, 2, 1], [1, 1, 2, 3, 1, 3, 3, 3, 3, 2], [1, 1, 3, 3, 2, 3, 2, 3, 2, 1], [1, 3, 2, 2, 3, 3, 3, 1, 3, 1], [2, 1, 3, 2, 2, 2, 2, 2, 3, 2]]
 
 
First 15 Rhondas in base 6:
In base 10: [855, 1029, 3813, 5577, 7040, 7304, 15104, 19136, 35350, 36992, 41031, 42009, 60368, 65536, 67821]
In base 6: [[3, 5, 4, 3], [4, 4, 3, 3], [2, 5, 3, 5, 3], [4, 1, 4, 5, 3], [5, 2, 3, 3, 2], [5, 3, 4, 5, 2], [1, 5, 3, 5, 3, 2], [2, 2, 4, 3, 3, 2], [4, 3, 1, 3, 5, 4], [4, 4, 3, 1, 3, 2], [5, 1, 3, 5, 4, 3], [5, 2, 2, 2, 5, 3], [1, 1, 4, 3, 2, 5, 2], [1, 2, 2, 3, 2, 2, 4], [1, 2, 4, 1, 5, 5, 3]]
 
 
First 15 Rhondas in base 8:
In base 10: [1836, 6318, 6622, 10530, 14500, 14739, 17655, 18550, 25398, 25956, 30562, 39215, 39325, 50875, 51429]
In base 8: [[3, 4, 5, 4], [1, 4, 2, 5, 6], [1, 4, 7, 3, 6], [2, 4, 4, 4, 2], [3, 4, 2, 4, 4], [3, 4, 6, 2, 3], [4, 2, 3, 6, 7], [4, 4, 1, 6, 6], [6, 1, 4, 6, 6], [6, 2, 5, 4, 4], [7, 3, 5, 4, 2], [1, 1, 4, 4, 5, 7], [1, 1, 4, 6, 3, 5], [1, 4, 3, 2, 7, 3], [1, 4, 4, 3, 4, 5]]
 
 
First 15 Rhondas in base 9:
In base 10: [15540, 21054, 25331, 44360, 44660, 44733, 47652, 50560, 54944, 76857, 77142, 83334, 83694, 96448, 97944]
In base 9: [[2, 3, 2, 7, 6], [3, 1, 7, 8, 3], [3, 7, 6, 6, 5], [6, 6, 7, 5, 8], [6, 7, 2, 3, 2], [6, 7, 3, 2, 3], [7, 2, 3, 2, 6], [7, 6, 3, 1, 7], [8, 3, 3, 2, 8], [1, 2, 6, 3, 7, 6], [1, 2, 6, 7, 3, 3], [1, 3, 6, 2, 7, 3], [1, 3, 6, 7, 2, 3], [1, 5, 6, 2, 6, 4], [1, 5, 8, 3, 1, 6]]
 
 
First 15 Rhondas in base 10:
In base 10: [1568, 2835, 4752, 5265, 5439, 5664, 5824, 5832, 8526, 12985, 15625, 15698, 19435, 25284, 25662]
In base 10: [[1, 5, 6, 8], [2, 8, 3, 5], [4, 7, 5, 2], [5, 2, 6, 5], [5, 4, 3, 9], [5, 6, 6, 4], [5, 8, 2, 4], [5, 8, 3, 2], [8, 5, 2, 6], [1, 2, 9, 8, 5], [1, 5, 6, 2, 5], [1, 5, 6, 9, 8], [1, 9, 4, 3, 5], [2, 5, 2, 8, 4], [2, 5, 6, 6, 2]]
 
 
First 15 Rhondas in base 12:
In base 10: [560, 800, 3993, 4425, 4602, 4888, 7315, 8296, 9315, 11849, 12028, 13034, 14828, 15052, 16264]
In base 12: [[3, 10, 8], [5, 6, 8], [2, 3, 8, 9], [2, 6, 8, 9], [2, 7, 11, 6], [2, 9, 11, 4], [4, 2, 9, 7], [4, 9, 7, 4], [5, 4, 8, 3], [6, 10, 3, 5], [6, 11, 6, 4], [7, 6, 6, 2], [8, 6, 11, 8], [8, 8, 6, 4], [9, 4, 11, 4]]
 
 
First 15 Rhondas in base 14:
In base 10: [11475, 18655, 20565, 29631, 31725, 45387, 58404, 58667, 59950, 63945, 67525, 68904, 91245, 99603, 125543]
In base 14: [[4, 2, 7, 9], [6, 11, 2, 7], [7, 6, 12, 13], [10, 11, 2, 7], [11, 7, 12, 1], [1, 2, 7, 7, 13], [1, 7, 3, 13, 10], [1, 7, 5, 4, 7], [1, 7, 11, 12, 2], [1, 9, 4, 3, 7], [1, 10, 8, 7, 3], [1, 11, 1, 7, 10], [2, 5, 3, 7, 7], [2, 8, 4, 2, 7], [3, 3, 10, 7, 5]]
 
 
First 15 Rhondas in base 15:
In base 10: [2392, 2472, 11468, 15873, 17424, 18126, 19152, 20079, 24388, 30758, 31150, 33004, 33550, 37925, 39483]
In base 15: [[10, 9, 7], [10, 14, 12], [3, 5, 14, 8], [4, 10, 8, 3], [5, 2, 6, 9], [5, 5, 8, 6], [5, 10, 1, 12], [5, 14, 3, 9], [7, 3, 5, 13], [9, 1, 10, 8], [9, 3, 6, 10], [9, 11, 10, 4], [9, 14, 1, 10], [11, 3, 8, 5], [11, 10, 7, 3]]
 
 
First 15 Rhondas in base 16:
In base 10: [1000, 1134, 6776, 15912, 19624, 20043, 20355, 23946, 26296, 29070, 31906, 32292, 34236, 34521, 36465]
In base 16: [[3, 14, 8], [4, 6, 14], [1, 10, 7, 8], [3, 14, 2, 8], [4, 12, 10, 8], [4, 14, 4, 11], [4, 15, 8, 3], [5, 13, 8, 10], [6, 6, 11, 8], [7, 1, 8, 14], [7, 12, 10, 2], [7, 14, 2, 4], [8, 5, 11, 12], [8, 6, 13, 9], [8, 14, 7, 1]]
 
 
 
</pre>
 
=={{header|Perl}}==
{{libheader|ntheory}}
<syntaxhighlight lang="perl">use strict;
use warnings;
use feature 'say';
use ntheory qw<is_prime factor vecsum vecprod todigitstring todigits>;
 
sub rhonda {
my($b, $cnt) = @_;
my(@r,$n);
while (++$n) {
push @r, $n if ($b * vecsum factor($n)) == vecprod todigits($n,$b);
return @r if $cnt == @r;
}
}
 
for my $b (grep { ! is_prime $_ } 2..36) {
my @Rb = map { todigitstring($_,$b) } my @R = rhonda($b, 15);
say <<~EOT;
First 15 Rhonda numbers to base $b:
In base $b: @Rb
In base 10: @R
EOT
}
</syntaxhighlight>
{{out}}
<pre style="height:20ex">First 15 Rhonda numbers to base 4:
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
 
First 15 Rhonda numbers to base 6:
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
 
First 15 Rhonda numbers to base 8:
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
 
First 15 Rhonda numbers to base 9:
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
 
First 15 Rhonda numbers to base 14:
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
 
First 15 Rhonda numbers to base 15:
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
 
First 15 Rhonda numbers to base 16:
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
 
First 15 Rhonda numbers to base 18:
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
 
First 15 Rhonda numbers to base 20:
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
 
First 15 Rhonda numbers to base 21:
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
 
First 15 Rhonda numbers to base 22:
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
 
First 15 Rhonda numbers to base 24:
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
 
First 15 Rhonda numbers to base 25:
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
 
First 15 Rhonda numbers to base 26:
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
 
First 15 Rhonda numbers to base 27:
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
 
First 15 Rhonda numbers to base 28:
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
First 15 Rhonda numbers to base 30:
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
 
First 15 Rhonda numbers to base 32:
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
 
First 15 Rhonda numbers to base 33:
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
 
First 15 Rhonda numbers to base 34:
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
 
First 15 Rhonda numbers to base 35:
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
 
First 15 Rhonda numbers to base 36:
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
</pre>
 
=={{header|Phix}}==
<!--<syntaxhighlight lang="phix">(phixonline)-->
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">fmt</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"""
First 15 Rhonda numbers in base %d:
In base 10: %s
In base %-2d: %s
"""</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">digit</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">d</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #000000;">d</span><span style="color: #0000FF;">-</span><span style="color: #008080;">iff</span><span style="color: #0000FF;">(</span><span style="color: #000000;">d</span><span style="color: #0000FF;"><=</span><span style="color: #008000;">'9'</span><span style="color: #0000FF;">?</span><span style="color: #008000;">'0'</span><span style="color: #0000FF;">:</span><span style="color: #008000;">'a'</span><span style="color: #0000FF;">-</span><span style="color: #000000;">10</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">for</span> <span style="color: #000000;">base</span><span style="color: #0000FF;">=</span><span style="color: #000000;">2</span> <span style="color: #008080;">to</span> <span style="color: #000000;">36</span> <span style="color: #008080;">do</span>
<span style="color: #008080;">if</span> <span style="color: #008080;">not</span> <span style="color: #7060A8;">is_prime</span><span style="color: #0000FF;">(</span><span style="color: #000000;">base</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">then</span>
<span style="color: #004080;">sequence</span> <span style="color: #000000;">rhondab</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{},</span> <span style="color: #000080;font-style:italic;">-- (base)</span>
<span style="color: #000000;">rhondad</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{}</span> <span style="color: #000080;font-style:italic;">-- (decimal)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">n</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">1</span>
<span style="color: #008080;">while</span> <span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">rhondab</span><span style="color: #0000FF;">)<</span><span style="color: #000000;">15</span> <span style="color: #008080;">do</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">digits</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"%a"</span><span style="color: #0000FF;">,{{</span><span style="color: #000000;">base</span><span style="color: #0000FF;">,</span><span style="color: #000000;">n</span><span style="color: #0000FF;">}})</span>
<span style="color: #008080;">if</span> <span style="color: #008080;">not</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'0'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">and</span> <span style="color: #0000FF;">(</span><span style="color: #000000;">base</span><span style="color: #0000FF;">!=</span><span style="color: #000000;">10</span> <span style="color: #008080;">or</span> <span style="color: #0000FF;">(</span><span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #008000;">'5'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">and</span> <span style="color: #7060A8;">sum</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">even</span><span style="color: #0000FF;">))!=</span><span style="color: #000000;">0</span><span style="color: #0000FF;">))</span> <span style="color: #008080;">then</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">pd</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">product</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">apply</span><span style="color: #0000FF;">(</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">,</span><span style="color: #000000;">digit</span><span style="color: #0000FF;">)),</span>
<span style="color: #000000;">bs</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">base</span><span style="color: #0000FF;">*</span><span style="color: #7060A8;">sum</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">prime_factors</span><span style="color: #0000FF;">(</span><span style="color: #000000;">n</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">))</span>
<span style="color: #008080;">if</span> <span style="color: #000000;">pd</span><span style="color: #0000FF;">==</span><span style="color: #000000;">bs</span> <span style="color: #008080;">then</span>
<span style="color: #004080;">string</span> <span style="color: #000000;">decdig</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"%d"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">n</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">l</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">max</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">decdig</span><span style="color: #0000FF;">),</span><span style="color: #7060A8;">length</span><span style="color: #0000FF;">(</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">))</span>
<span style="color: #000000;">rhondab</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">rhondab</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">pad_head</span><span style="color: #0000FF;">(</span><span style="color: #000000;">digits</span><span style="color: #0000FF;">,</span><span style="color: #000000;">l</span><span style="color: #0000FF;">))</span>
<span style="color: #000000;">rhondad</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">rhondad</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">pad_head</span><span style="color: #0000FF;">(</span><span style="color: #000000;">decdig</span><span style="color: #0000FF;">,</span><span style="color: #000000;">l</span><span style="color: #0000FF;">))</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #000000;">n</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">1</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">fmt</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">base</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #000000;">rhondad</span><span style="color: #0000FF;">),</span><span style="color: #000000;">base</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">join</span><span style="color: #0000FF;">(</span><span style="color: #000000;">rhondab</span><span style="color: #0000FF;">)})</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<!--</syntaxhighlight>-->
{{out}}
<pre style="height:40ex;overflow:scroll;">
First 15 Rhonda numbers in base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4 : 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers in base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6 : 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers in base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8 : 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers in base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9 : 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers in base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers in base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhonda numbers in base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhonda numbers in base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhonda numbers in base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhonda numbers in base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhonda numbers in base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhonda numbers in base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhonda numbers in base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhonda numbers in base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhonda numbers in base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhonda numbers in base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhonda numbers in base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhonda numbers in base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhonda numbers in base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhonda numbers in base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhonda numbers in base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhonda numbers in base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhonda numbers in base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhonda numbers in base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
</pre>
 
=={{header|Raku}}==
Find and show the first 15 so as to display the namesake Rhonda number 25662.
<syntaxhighlight lang="raku" perl6line>use Prime::Factor;
 
my @factor-sum;
Line 125 ⟶ 2,216:
put "In base 10: " ~ @rhonda».fmt("%{$ch}s").join: ', ';
put $b.fmt("In base %2d: ") ~ @rhonda».base($b)».fmt("%{$ch}s").join: ', ';
}</langsyntaxhighlight>
{{out}}
<pre style="height:40ex;overflow:scroll;">First 15 Rhonda numbers to base 4:
Line 222 ⟶ 2,313:
In base 10: 1000, 4800, 5670, 8190, 10998, 12412, 13300, 15750, 16821, 23016, 51612, 52734, 67744, 70929, 75030
In base 36: RS, 3PC, 4DI, 6BI, 8HI, 9KS, A9G, C5I, CZ9, HRC, 13TO, 14OU, 1G9S, 1IQ9, 1LW6</pre>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">// [dependencies]
// radix_fmt = "1.0"
 
fn digit_product(base: u32, mut n: u32) -> u32 {
let mut product = 1;
while n != 0 {
product *= n % base;
n /= base;
}
product
}
 
fn prime_factor_sum(mut n: u32) -> u32 {
let mut sum = 0;
while (n & 1) == 0 {
sum += 2;
n >>= 1;
}
let mut p = 3;
while p * p <= n {
while n % p == 0 {
sum += p;
n /= p;
}
p += 2;
}
if n > 1 {
sum += n;
}
sum
}
 
fn is_prime(n: u32) -> bool {
if n < 2 {
return false;
}
if n % 2 == 0 {
return n == 2;
}
if n % 3 == 0 {
return n == 3;
}
let mut p = 5;
while p * p <= n {
if n % p == 0 {
return false;
}
p += 2;
if n % p == 0 {
return false;
}
p += 4;
}
true
}
 
fn is_rhonda(base: u32, n: u32) -> bool {
digit_product(base, n) == base * prime_factor_sum(n)
}
 
fn main() {
let limit = 15;
for base in 2..=36 {
if is_prime(base) {
continue;
}
println!("First {} Rhonda numbers to base {}:", limit, base);
let numbers: Vec<u32> = (1..).filter(|x| is_rhonda(base, *x)).take(limit).collect();
print!("In base 10:");
for n in &numbers {
print!(" {}", n);
}
print!("\nIn base {}:", base);
for n in &numbers {
print!(" {}", radix_fmt::radix(*n, base as u8));
}
print!("\n\n");
}
}</syntaxhighlight>
 
{{out}}
<pre style="height:40ex;">
First 15 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
 
</pre>
 
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">func is_rhonda_number(n, base = 10) {
base.is_composite || return false
n > 0 || return false
n.digits(base).prod == base*n.factor.sum
}
 
for b in (2..16 -> grep { .is_composite }) {
say ("First 10 Rhonda numbers to base #{b}: ",
10.by { is_rhonda_number(_, b) })
}</syntaxhighlight>
{{out}}
<pre>
First 10 Rhonda numbers to base 4: [10206, 11935, 12150, 16031, 45030, 94185, 113022, 114415, 191149, 244713]
First 10 Rhonda numbers to base 6: [855, 1029, 3813, 5577, 7040, 7304, 15104, 19136, 35350, 36992]
First 10 Rhonda numbers to base 8: [1836, 6318, 6622, 10530, 14500, 14739, 17655, 18550, 25398, 25956]
First 10 Rhonda numbers to base 9: [15540, 21054, 25331, 44360, 44660, 44733, 47652, 50560, 54944, 76857]
First 10 Rhonda numbers to base 10: [1568, 2835, 4752, 5265, 5439, 5664, 5824, 5832, 8526, 12985]
First 10 Rhonda numbers to base 12: [560, 800, 3993, 4425, 4602, 4888, 7315, 8296, 9315, 11849]
First 10 Rhonda numbers to base 14: [11475, 18655, 20565, 29631, 31725, 45387, 58404, 58667, 59950, 63945]
First 10 Rhonda numbers to base 15: [2392, 2472, 11468, 15873, 17424, 18126, 19152, 20079, 24388, 30758]
First 10 Rhonda numbers to base 16: [1000, 1134, 6776, 15912, 19624, 20043, 20355, 23946, 26296, 29070]
</pre>
 
=={{header|Swift}}==
<syntaxhighlight lang="swift">func digitProduct(base: Int, num: Int) -> Int {
var product = 1
var n = num
while n != 0 {
product *= n % base
n /= base
}
return product
}
 
func primeFactorSum(_ num: Int) -> Int {
var sum = 0
var n = num
while (n & 1) == 0 {
sum += 2
n >>= 1
}
var p = 3
while p * p <= n {
while n % p == 0 {
sum += p
n /= p
}
p += 2
}
if n > 1 {
sum += n
}
return sum
}
 
func isPrime(_ n: Int) -> Bool {
if n < 2 {
return false
}
if n % 2 == 0 {
return n == 2
}
if n % 3 == 0 {
return n == 3
}
var p = 5
while p * p <= n {
if n % p == 0 {
return false
}
p += 2
if n % p == 0 {
return false
}
p += 4
}
return true
}
 
func isRhonda(base: Int, num: Int) -> Bool {
return digitProduct(base: base, num: num) == base * primeFactorSum(num)
}
 
let limit = 15
for base in 2...36 {
if isPrime(base) {
continue
}
print("First \(limit) Rhonda numbers to base \(base):")
let numbers = Array((1...).lazy.filter{ isRhonda(base: base, num: $0) }.prefix(limit))
print("In base 10:", terminator: "")
for n in numbers {
print(" \(n)", terminator: "")
}
print("\nIn base \(base):", terminator: "")
for n in numbers {
print(" \(String(n, radix: base))", terminator: "")
}
print("\n")
}</syntaxhighlight>
 
{{out}}
<pre style="height:40ex;">
First 15 Rhonda numbers to base 4:
In base 10: 10206 11935 12150 16031 45030 94185 113022 114415 191149 244713 259753 374782 392121 503773 649902
In base 4: 2133132 2322133 2331312 3322133 22333212 112333221 123211332 123323233 232222231 323233221 333122221 1123133332 1133232321 1322333131 2132222232
 
First 15 Rhonda numbers to base 6:
In base 10: 855 1029 3813 5577 7040 7304 15104 19136 35350 36992 41031 42009 60368 65536 67821
In base 6: 3543 4433 25353 41453 52332 53452 153532 224332 431354 443132 513543 522253 1143252 1223224 1241553
 
First 15 Rhonda numbers to base 8:
In base 10: 1836 6318 6622 10530 14500 14739 17655 18550 25398 25956 30562 39215 39325 50875 51429
In base 8: 3454 14256 14736 24442 34244 34623 42367 44166 61466 62544 73542 114457 114635 143273 144345
 
First 15 Rhonda numbers to base 9:
In base 10: 15540 21054 25331 44360 44660 44733 47652 50560 54944 76857 77142 83334 83694 96448 97944
In base 9: 23276 31783 37665 66758 67232 67323 72326 76317 83328 126376 126733 136273 136723 156264 158316
 
First 15 Rhonda numbers to base 10:
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
In base 10: 1568 2835 4752 5265 5439 5664 5824 5832 8526 12985 15625 15698 19435 25284 25662
 
First 15 Rhonda numbers to base 12:
In base 10: 560 800 3993 4425 4602 4888 7315 8296 9315 11849 12028 13034 14828 15052 16264
In base 12: 3a8 568 2389 2689 27b6 29b4 4297 4974 5483 6a35 6b64 7662 86b8 8864 94b4
 
First 15 Rhonda numbers to base 14:
In base 10: 11475 18655 20565 29631 31725 45387 58404 58667 59950 63945 67525 68904 91245 99603 125543
In base 14: 4279 6b27 76cd ab27 b7c1 1277d 173da 17547 17bc2 19437 1a873 1b17a 25377 28427 33a75
 
First 15 Rhonda numbers to base 15:
In base 10: 2392 2472 11468 15873 17424 18126 19152 20079 24388 30758 31150 33004 33550 37925 39483
In base 15: a97 aec 35e8 4a83 5269 5586 5a1c 5e39 735d 91a8 936a 9ba4 9e1a b385 ba73
 
First 15 Rhonda numbers to base 16:
In base 10: 1000 1134 6776 15912 19624 20043 20355 23946 26296 29070 31906 32292 34236 34521 36465
In base 16: 3e8 46e 1a78 3e28 4ca8 4e4b 4f83 5d8a 66b8 718e 7ca2 7e24 85bc 86d9 8e71
 
First 15 Rhonda numbers to base 18:
In base 10: 1470 3000 8918 17025 19402 20650 21120 22156 26522 36549 38354 43281 46035 48768 54229
In base 18: 49c 94c 1998 2g9f 35fg 39d4 3b36 3e6g 49f8 64e9 6a6e 77a9 7g19 8696 956d
 
First 15 Rhonda numbers to base 20:
In base 10: 1815 11050 15295 21165 22165 30702 34510 34645 42292 44165 52059 53416 65945 78430 80712
In base 20: 4af 17ca 1i4f 2ci5 2f85 3gf2 465a 46c5 55ec 5a85 6a2j 6dag 84h5 9g1a a1fc
 
First 15 Rhonda numbers to base 21:
In base 10: 1632 5390 8512 12992 15678 25038 29412 34017 39552 48895 49147 61376 85078 89590 91798
In base 21: 3ef c4e j67 189e 1ebc 2eg6 33ec 3e2i 45e9 55i7 5697 6d3e 93j7 9e34 9j37
 
First 15 Rhonda numbers to base 22:
In base 10: 2695 4128 7865 28800 31710 37030 71875 74306 117760 117895 121626 126002 131427 175065 192753
In base 22: 5cb 8be g5b 2fb2 2lb8 3ab4 6gb1 6lbc b16g b1cj b96a bi78 c7bl g9fb i25b
 
First 15 Rhonda numbers to base 24:
In base 10: 2080 2709 3976 5628 5656 7144 8296 9030 10094 17612 20559 24616 26224 29106 31458
In base 24: 3eg 4gl 6lg 9ic 9jg c9g e9g fg6 hce 16dk 1bgf 1ihg 1lcg 22ci 26ei
 
First 15 Rhonda numbers to base 25:
In base 10: 6764 9633 13260 22022 53382 57640 66015 69006 97014 140130 142880 144235 159724 162565 165504
In base 25: ake fa8 l5a 1a5m 3aa7 3h5f 45ff 4aa6 655e 8o55 93f5 95ja a5do aa2f aek4
 
First 15 Rhonda numbers to base 26:
In base 10: 7788 9322 9374 11160 22165 27885 34905 44785 47385 49257 62517 72709 74217 108745 132302
In base 26: bde dke dme gd6 16kd 1f6d 1pgd 2e6d 2i2d 2kmd 3ecd 43ed 45kd 64md 7die
 
First 15 Rhonda numbers to base 27:
In base 10: 4797 11844 12078 13200 14841 17750 24320 26883 27477 46455 52750 58581 61009 61446 61500
In base 27: 6fi g6i gf9 i2o k9i o9b 169k 19ni 1aii 29jf 2i9j 2q9i 32ig 337l 339l
 
First 15 Rhonda numbers to base 28:
In base 10: 3094 5808 5832 7462 11160 13671 27270 28194 28638 39375 39550 49500 50862 52338 52938
In base 28: 3qe 7bc 7c8 9ee e6g hc7 16lq 17qq 18em 1m67 1mce 273o 28oe 2al6 2bei
 
First 15 Rhonda numbers to base 30:
In base 10: 3024 3168 5115 5346 5950 6762 7750 7956 8470 9476 9576 9849 10360 11495 13035
In base 30: 3ao 3fi 5kf 5s6 6ia 7fc 8ia 8p6 9ca afq aj6 as9 bfa cn5 eef
 
First 15 Rhonda numbers to base 32:
In base 10: 1944 3600 13520 15876 16732 16849 25410 25752 28951 47472 49610 50968 61596 64904 74005
In base 32: 1so 3gg d6g fg4 gas geh oq2 p4o s8n 1ebg 1gea 1hoo 1s4s 1vc8 288l
 
First 15 Rhonda numbers to base 33:
In base 10: 756 7040 7568 13826 24930 30613 59345 63555 64372 131427 227840 264044 313709 336385 344858
In base 33: mu 6fb 6vb cmw mtf s3m 1lgb 1pbu 1q3m 3lml 6b78 7bfb 8o2b 9btg 9jm8
 
First 15 Rhonda numbers to base 34:
In base 10: 5661 14161 15620 16473 22185 37145 125579 134692 135405 138472 140369 177086 250665 255552 295614
In base 34: 4uh c8h dhe e8h j6h w4h 36lh 3ehi 3f4h 3hqo 3jeh 4h6e 6csh 6h28 7hoi
 
First 15 Rhonda numbers to base 35:
In base 10: 8232 9476 9633 18634 30954 41905 52215 52440 56889 61992 62146 66339 98260 102180 103305
In base 35: 6p7 7pq 7u8 f7e p9e y7a 17lu 17sa 1bfe 1fl7 1fpl 1j5e 2a7f 2def 2ebk
 
First 15 Rhonda numbers to base 36:
In base 10: 1000 4800 5670 8190 10998 12412 13300 15750 16821 23016 51612 52734 67744 70929 75030
In base 36: rs 3pc 4di 6bi 8hi 9ks a9g c5i cz9 hrc 13to 14ou 1g9s 1iq9 1lw6
 
</pre>
 
=={{header|Wren}}==
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<langsyntaxhighlight ecmascriptlang="wren">import "./math" for Math, Int, Nums
import "./fmt" for Fmt, Conv
 
Line 258 ⟶ 2,732:
Fmt.print("In base $-2d: $*s", b, maxLen, rhonda3)
}
}</langsyntaxhighlight>
 
{{out}}
2,122

edits