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

Home > Numbers
function of s.o.d. of prime (Posted on 2021-12-31) Difficulty: 3 of 5
Solve g(sod(p)) = p where:

p is a prime number.
g(x) = Ax^2 + Bx + C
A, B, and C are single digit positive integers.
sod() is the sum of digits function
and, the combined digits of A, B, C, p and sod(p) include each of the digits 1 through 9 exactly once.

Find A, B, C, p and sod(p)

See The Solution Submitted by Larry    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |
clc, clearvars
for pNo=1:9592
    p=nthprime(pNo);
    s=0;
    pdgts=num2str(p) ;
    if isequal(unique(pdgts),sort(pdgts)) && ~contains(pdgts,'0')
        l=length(pdgts) ;
        for i=1:l
            s=s+str2double(pdgts(i));
        end
        digused=[pdgts num2str(s)];
        if isequal(unique(digused),sort(digused))
            if length(digused)==6
              if ~contains(digused,'0')  
                abc=setdiff('123456789',digused);
                abcs=perms(abc);
                for i=1:length(abcs)
                    abc=abcs(i,:);
                    a=str2double(abc(1));
                    b=str2double(abc(2));
                    c=str2double(abc(3));
                    g=a*s^2+b*s+c;
                    if g==p
                       disp([a b c p s]) 
                    end
                end
              end
            end 
        end
    end
    sd=s;
end

finds

     9           8           5        2437          16
     
as   A           B           C          p          sod(p)

as 9*16^2 + 8*16 + 5 = 2437

  Posted by Charlie on 2021-12-31 10:29:10
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 (15)
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