All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Arithmetic Derivative (Posted on 2022-06-10) Difficulty: 4 of 5
Consider the following (simplified) definition of the "Arithmetic Derivative" for n in positive integers:
D(0) = D(1) = 0
D(prime) = 1
D(ab) = D(a)*b + D(b)*a

Examples:
D(7) = 1 because 7 is prime.
D(30) = D(5*6) = D(5)*6 + 5*D(6) = 1*6 + 5*D(2*3)
= 6 + 5*[D(2)*3+2*D(3)] = 6 + 5*5 = 31, so ...
D(30) = 31
D(58) = 31 (More than one integer can have the same Arithmetic Derivative.)

(1). Find n and D(n) (n up to 5 digits) such that D(n) is the largest.
(2). Find n and D(n) (n up to 5 digits and not prime) such that the ratio D(n)/n is the largest.
(3). Which 4-digit Palindrome is the Arithmetic Derivative of the most 4-digit positive integers, and list them.
(4). For what set of n is n = D(n)

No Solution Yet Submitted by Larry    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 7
clc,clearvars

upto=99999
d=zeros(1,upto); largei=[]; largest=0;
largerat=0;largeir=[]; self=[];
for i=2:upto
  
  if isprime(i)
    d(i)=1;
  else
    f=factor(i);
    f1=f(1);
    f2=i/f1;
    d(i)=f1*d(f2)+f2;
  end
end

fid=fopen('ADset.txt','w');
for j=2:upto
  fprintf(fid,'%10d %14d\n',j,d(j));
end
fclose(fid);

m=max(d);
psn=find(d==m);
disp(psn)
disp(d(psn))
disp(' ')
for j=2:upto
  rat(j)=d(j)/j;
end
m=max(rat);
psn=find(rat==m);
disp(psn)
disp(rat(psn))
disp(d(psn))
disp(' ')
for j=1:upto
  if j==d(j)
    disp(j); 
  end
end

pal=[];  
for j=1:upto
  if isPalin(d(j)) && d(j) ~= 1
    f=find(d==d(j));
    ctpal=length(f);
    pal(end+1)=d(j);
    disp([j d(j) ctpal])
  end
end
disp(' ')
pal=sort(pal);
pal'

function ip=isPalin(x)
  s=char(string(x));
  if isequal(s,flip(s))
      ip=true;
  else
      ip=false;
  end 
end  


------------
An aside:

      f=factor(i);
      f1=f(1);
      f2=i/f1;
      d(i)=f1*d(f2)+f2;
 

works even for primes. f(1), which becomes f1, is the first prime factor of i; for a prime i, it is i itself, so when divided into itself the result is 1 which is f2. Then d(f2)=d(1)=0, and when f2=1 is added,the result is 1. This alternative formulation would be:

D(0) = D(1) = 0
 
D(n) = D(a)*b + a, where a is the smallest prime factor of n and b=n/a.

Then D(ab) = D(a)*b + D(b)*a becomes merely a property of the D function.

This came to light during testing where a faulty prime check failed to detect primes because the wrong variable was being checked, but the results were still correct.

----------

The first output was

       98304
      770048
 
       65536
     8
      524288
 
     4
    27
        3125
        
Which means

(1)

The highest D(n) for n up to 99999 was 770048, for n=98304.

(2)

The highest ratio D(n)/n was 8 for D(65536)=524288.

(4)

D(n)=n for n=4, 27 and 3125 only.  I don't know if it means anything that these are 2^2, 3^3 and 5^5. But D(7^7) = 7^7 = 823543 and D(11^11) = 11^11 = 285311670611, based on

function dee=d(n)
 if n==1
   dee=0;
 else
    f=factor(n);
    f1=f(1);
    f2=n/f1;
    dee=f1*d(f2)+f2;
 end  
end

so it looks likes D(p^p) = p^p for any prime p.

(3)

Palindromic D(n) by n. The last column contains the number of times this palindrome occurs as the D value within the first 9999 values of n. The largest number of occurrences is of 1991, which occurs 13 times, starting at n = 2382.

Interesting that 636 occurs only twice in this list, vs 29 times in the longer list (for 5-digit n). On the other side is the fact that 1991, occurring 13 times below n=9999, occurs only 16 times when the list was expanded to n=99999.

           n       D(n)       occurrences of  this D             
           1           0           1
           4           4           1
           6           5           1
           9           6           1
          10           7           1
          14           9           1
          15           8           1
          24          44           4
          57          22           3
          62          33           1
          75          55           2
          85          22           3
          96         272           5
          98          77           1
         106          55           2
         114         101           2
         121          22           3
         123          44           4
         130         101           2
         136         212           5
         138         121           1
         153         111           2
         174         151           4
         182         131           2
         186         161           1
         194          99           1
         196         252           7
         218         111           2
         222         191           4
         230         171           1
         231         131           2
         255         151           4
         259          44           4
         268         272           5
         273         151           4
         278         141           1
         286         191           4
         298         151           4
         305          66           6
         357         191           4
         358         181           1
         364         444           5
         396         696           4
         403          44           4
         413          66           6
         415          88           4
         455         191           4
         495         474           5
         531         363           2
         532         636           2
         546         575           2
         550         545           2
         574         383           3
         576        2112           2
         597         202           7
         615         343           2
         622         313           1
         652         656           3
         662         333           1
         687         232           4
         689          66           6
         692         696           4
         717         242           5
         726         737           2
         741         343           2
         807         272           5
         826         545           2
         844         848           1
         870         929           1
         893          66           6
         902         555           2
         985         202           7
         986         585           1
         989          66           6
        1006         505           1
        1010         717           1
        1014        1001           2
        1015         383           3
        1046         525           1
        1073          66           6
        1126         565           1
        1135         232           4
        1184        2992           1
        1186         595           1
        1194        1001           2
        1203         404           2
        1207          88           4
        1209         535           1
        1258         737           2
        1263         424           3
        1285         262           4
        1293         434           2
        1309         383           3
        1314        1551           4
        1325         555           2
        1331         363           2
        1335         727           2
        1370         969           2
        1383         464           2
        1385         282           6
        1473         494           2
        1677         727           2
        1695         919           1
        1711          88           4
        1730        1221           2
        1814         909           1
        1839         616           1
        1874         939           2
        1894         949           1
        1927          88           4
        1929         646           2
        1934         969           2
        1936        4224           1
        1954         979           1
        1959         656           3
        1986        1661           2
        1994         999           3
        2019         676           1
        2045         414           3
        2049         686           2
        2055        1111           5
        2095         424           3
        2101         202           7
        2118        1771           1
        2135         767           3
        2162        1221           2
        2195         444           5
        2218        1111           5
        2245         454           3
        2261         575           2
        2289        1111           5
        2303         707           1
        2313        1551           4
        2321         222           7
        2337         959           1
        2382        1991          13
        2385        2112           2
        2395         484           2
        2587         212           5
        2613        1111           5
        2635         767           3
        2651         252           7
        2703        1111           5
        2751        1331           2
        2761         262           4
        2779         404           2
        2830        1991          13
        2834        1661           2
        2878        1441           1
        2977         242           5
        2981         282           6
        3005         606           3
        3090        3223           4
        3091         292           3
        3098        1551           4
        3107         252           7
        3155         636           2
        3199         464           2
        3205         646           2
        3245         999           3
        3269         474           5
        3305         666           3
        3324        4444           1
        3406        1991          13
        3409         494           2
        3455         696           4
        3497         282           6
        3502        1991          13
        3667         212           5
        3758        1881           1
        3887         767           3
        4072        6116           1
        4115         828           2
        4117         202           7
        4123         939           2
        4137        1991          13
        4193         606           3
        4235        2222           1
        4237         242           5
        4265         858           1
        4315         868           2
        4333         626           2
        4380        6776           3
        4408        6996           1
        4415         888           3
        4427         252           7
        4491        3003           2
        4577         222           7
        4613         666           3
        4650        5885           2
        4763         444           5
        4873         454           3
        4908        6556           1
        4947        1991          13
        4997         282           6
        5017         202           7
        5082        5885           2
        5093         474           5
        5213         414           3
        5217        1991          13
        5267         252           7
        5324        6776           3
        5423         999           3
        5473         434           2
        5497         262           4
        5597         222           7
        5603         444           5
        5611         212           5
        5677         818           1
        5690        3993           1
        5705        1991          13
        5747         828           2
        5760       25152           1
        5921         222           7
        5929        2772           1
        5964        8888           2
        5993         474           5
        5997        2002           2
        6002        3003           2
        6015        3223           4
        6076        8008           1
        6167         888           3
        6187         292           3
        6332        6336           1
        6442        3223           4
        6462        7557           2
        6467         252           7
        6492        8668           1
        6494        3663           1
        6541         242           5
        6643        1551           4
        6662        3333           1
        6749         414           3
        6757         262           4
        6772        6776           3
        6955        1991          13
        7421         222           7
        7471         272           5
        7505        1991          13
        7623        7557           2
        7627         292           3
        7647        2552           1
        7697         222           7
        7705        1991          13
        7709         606           3
        7710        7997           1
        7761        3223           4
        7762        3883           1
        7769         474           5
        7781         282           6
        7831         232           4
        7897         202           7
        7939         484           2
        7955        1991          13
        7969         626           2
        7977        2662           1
        8177        1331           2
        8349        4664           1
        8359         656           3
        8444        8448           1
        8489         666           3
        8557         242           5
        8637        2882           1
        8651         252           7
        8672       21712           1
        8730       12021           1
        8749         686           2
        8767         808           1
        8879         696           4
        8884        8888           2
        9010        7007           2
        9097         838           1
        9211         212           5
        9223         424           3
        9301         202           7
        9427         868           2
        9487         232           4
        9617         222           7
        9647         888           3
        9683         444           5
        9757         898           1
        9821        1991          13
        9847         272           5
        9881         282           6
        9913         454           3
        9922        7007           2
        9985        2002           2

  Posted by Charlie on 2022-06-10 11:02:48
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (21)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information