Find a 7-digit decimal number such that:
It is prime;
Its sod() is 38;
The sod() of the first 3 digits is the reverse of the sod() of the last 3 digits;
When it is converted from decimal to base-N, where N is any integer from 11 to 36, all 10 numeric digits and 23 different letters appear, but there is never a Q, S, or Z in its base-N representation (for those bases).
These constraints determine a unique 7-digit number.
Find it.
Bonus: what is its pop culture significance?
Note: the sod(N) is the sum of digits of N
clearvars
ct=0;
global thirty8 thirtyEight
thirtyEight=double.empty(0,7);
for i=0:9
thirty8=i;
addon;
end
for i=1:length(thirtyEight)
thirty8=thirtyEight(i,:);
list38=uniqueperms(thirty8);
for j=1:size(list38,1)
nAsList=list38(j,:);
ns=char(nAsList+48);
n=str2double(ns);
if isprime(n) && n>1000000
a=char(string(sod(ns(1:3))));
z=char(string(sod(ns(5:7))));
if isequal(a,flip(z))
had=[];
for base=11:36
bval=dec2base(n,base);
if length(strfind(bval,'Q'))>0
continue
end
if length(strfind(bval,'S'))>0
continue
end
if length(strfind(bval,'Z'))>0
continue
end
had(bval)=1;
end
if sum(had)==33
disp([n sum(had)])
disp(char(find(had==1)))
end
end
end
end
end
function addon
global thirty8 thirtyEight
for i=thirty8(end):9
if i+sum(thirty8)<=38
if i+sum(thirty8)+9*(6-length(thirty8))>=38
thirty8(end+1)=i;
if length(thirty8)==7
thirtyEight(end+1,:)=thirty8;
else
addon
end
thirty8=thirty8(1:end-1);
end
end
end
end
finds
8675309 33
0123456789ABCDEFGHIJKLMNOPRTUVWXY
being the number, the number of different digits used in bases 10 to 36, and those digits.
The number in pop culture represents a phone number, in the song "867-5309/Jenny" a 1981 song written by Alex Call and Jim Keller and performed by Tommy Tutone that was released on the album Tommy Tutone 2, on the Columbia Records label. It peaked at No. 4 on the Billboard Hot 100 chart in May 1982, and No. 1 on the Billboard Hot Mainstream Rock Tracks chart in April 1982. (Wikipedia)
|
Posted by Charlie
on 2023-07-28 12:25:19 |