+/m=.34=(b=.;fact ea n^2)+a=.;fact ea n=.1 to 100000
93
+/m=.34=(b=.;fact ea n^2)+a=.;fact ea n=.200000 to 300000
32
+/m=.34=(b=.;fact ea n^2)+a=.;fact ea n=.300000 to 400000
|limit error in fact, executing dyad q:
|a system limit was exceeded
| */>:_ q:y
Press ENTER to inspect
JVERSION
Engine: j9.6.0-beta25/j64avx2/windows
Build: commercial/2024-11-24T15:41:46/clang-18-1-8/SLEEF=1
Library: 9.6.9
Qt IDE: 2.5.3/6.5.3(6.5.3)
OS Ver: Windows 10 Version 22H2 10.0.19045
Platform: Win 64
Installer: j9.6 install
InstallPath: c:/program files/j9.6
Contact: www.jsoftware.com
fact=.{{*/>:_ q:y}}
fact 3020
12
If I understand the problem correctly,
sig=: */@:>:@:(1&({ ))@:(2&p:) NB. number of factors of y (i.e. sigma function)
>: I. 34= +/"1 sig"0@(*:,])"0 >: i. 150
36 100. So the number of integers less than 150 whose sum of factors added with the sum of factors of its square is 2.
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.
It's not necessary to having to square and factor large numbers to
solve this problem. Here are the first 6 solutions to this problem:
36 100 196 225 441 484
What is interesting is not their values but the number of unique
primes and how many of each prime.
q: 36 100 196 225 441 484
2 2 3 3
2 2 5 5
2 2 7 7
3 3 5 5
3 3 7 7
2 2 11 11
Any number that is the product of two pairs of any unique primes
will give a solution of 34.
What is needed is to create a verb that calculates the number
of factors for a number. First, given a prime raised to some
power p will have p+1 factors. Second, the number of ways a
set of n things can be grouped is given by !>:#n . Putting this
into a verb:
number_of_factors =: {{
'f p' =. __ q: y
*/(!<:#f),>:p
}}"0
number_of_factors 36
9
number_of_factors *:36
25
This can be put into one verb. But it is not necessary to square
the number. Simply double the number of each factor.
q:12
2 2 3
q:144
2 2 2 2 3 3
2#q:12
2 2 2 2 3 3
f_sq_f =: {{
'f p' =. __ q: y
nf =. */(!<:#f),>:p
nsqf =. */(!<:#f),>:+:p
nf+nsqf
}}"0
Here are the sums of the number of factors and its square for
a few numbers.
f_sq_f 2+i.10
5 5 8 5 13 5 11 8 13 5
Here is a list of the solutions to 2 to 100000.
list 2+I.34=f_sq_f 2+i.99998
36 100 196 225 441 484 676 1089 1156 1225
1444 1521 2116 2601 3025 3249 3364 3844 4225 4761
5476 5929 6724 7225 7396 7569 8281 8649 8836 9025
11236 12321 13225 13924 14161 14884 15129 16641 17689 17956
19881 20164 20449 21025 21316 24025 24964 25281 25921 27556
31329 31684 33489 34225 34969 37636 40401 40804 41209 42025
42436 43681 45369 45796 46225 47089 47524 47961 48841 51076
55225 56169 61009 62001 64009 64516 67081 68644 70225 71289
75076 77284 82369 84681 87025 88804 89401 90601 91204 91809
93025 95481 98596
And a list of the possible sums.
list /:~~.f_sq_f 2+i.99998
5 8 11 13 14 17 20 21
23 26 29 32 34 35 37 38
41 44 45 47 50 53 60 61
65 69 70 73 77 83 85 86
93 99 101 106 109 112 114 117
119 125 129 137 138 151 152 155
157 158 164 173 175 177 185 186
191 198 202 209 213 218 221 241
244 246 251 258 290 304 330 334
358 378 402 422 458 466 474 510
540 546 554 558 582 586 618 658
690 714 750 758 762 776 814 834
842 858 870 894 914 954 958 960
970 1012 1026 1042 1078 1170 1242 1326
1566 1698 2070 2178 2442 2574 2790 2814
3030 3186 3402 3558 3582 3882 4014 4236
4590 4626 4734 4974 4986 5238 5586 5598
5898 6066 6390 6600 10872 15144 17928 19416
23688 24984 27960 29592 32040 34824 95160 157320