Nom d'utilisateurGingerAle
Questions 2
Réponses 450


Can you please explain bases are. 


You will defiantly need an understanding of numeric bases to complete your assignment.

This link presents an overview of base conversions, giving examples using the same method I used in the outline. 

Google “base conversion” for other examples and methods of conversion. 


First, a rudimentary explanation of what base 10 means. There are only 10 unique numbers (0,1,2,3,4,5,6,7,8,9) –notice that zero (0) is one of these numbers. If a value greater than 9 is needed, then two digits are required.  When the 9 is incremented it returns to zero (0), and the digit to its left is incremented to show this happened. It then looks like this 10.   Where this “rollover” takes place is the base number.  Each value to the left is 10 times greater than its position on the right.


Most of the numbers we use are in base 10 –the decimal system. A clock however is in base 60 (Sexagesimal).  Note that one (1) second after a clock reads 11:59:59 the displays reads 12:00:00.  The minutes and seconds roll-over after 59, not 99.  Most do not realize that it is base 60 because most clocks are encoded to display in base 10.  This encoding is called “Decimal Encoded Sexagesimal”


Most people are so use to this that it’s not given a second thought.  Considering this ease of understanding of a very large base (60), it is just a matter of extending this understanding to other (much smaller) bases.


In the program outline, the base conversion process uses decimal encoding and then converts that decimal to a symbol, in this case a letter, when value is greater than 9. So a “10” becomes an “A”, and an “11” becomes “B”, ect.  If the display is set for decimal encoded base 17 then it might look like this: [14 | 8 |11 |8]17. After it’s conversion it will look like this: E8B817  


Remember that any decimal value greater than 9 requires two characters. For bases greater than base 10, additional, unique single characters are needed to represent the values. It’s standard practice to use letters of the alphabet for this purpose.


In your example you have written "71298 (the square of 267) to base 17"  What does this mean


The full text reads: “Here’s an example converting 71298 (the square of 267) to base 17.”

This means the example following will demonstrate how to convert the base 10 number (71298) to base 17.  This was chosen at random from the numbers you will be required to examine.


In the question they provide a base. 

Your assignment requires you to convert to 18 different bases.   (I’m not seeing any ambiguity in the wording for your assignment.)  


To clarify: Your assignment is to generate squares of (base 10) numbers from 1 to 300, then convert the squares to 18 other bases, starting with base 2 through base 20.  One such number will be 2672=71298.  I chose base 17 arbitrarily, as an example from one of the bases you will be converting to.


and how did you know to divide it by 17 as the base?


I knew to divide by 17 because to convert from one base to another requires division by that base.    


Like an example input would be 10 and the output would be: 


Your program will square 10, that is 100, then the 100 will be converted to bases 2,3,4,5, ... 17,18,19,20. Then each base conversion will be tested for a palindrome condition, if that is a true condition then the original base 10 number and its square will be printed along with the palindrome in base (b).



For now, work on understanding what a base is and how to convert to them.  This should only require a few hours of study and practice.  




11 févr. 2019

Here’s a basic outline for your assignment. The actual coding depends on the language used.


Define and Create arrays: Numeric N(300,2), String BC(300,20). The first is a 2-dimeintional numeric array (named N) with two columns of 300 elements.  The second is a string array (named BC) of 20 columns of 300 elements.


Generate numbers from 1 to 300 (base 10). Store these numbers sequentially in column (1) of array N(i,1)   “N” is the name of the array and (i) is the location in the array, and the (1) means the first column.


Using a sequential loop process, square the number stored in array N(i,1) and store it in array N(i,2).


Call subroutine Base Number Conversion.


This will be the most complex part of your program. Here, your code will convert and  populate the string array with the base_b equivalent of the number (N2) storing it in the location determined by (i). 


BC(i,1) is the index and the number N. BC(i,10) will be the base 10 location. This will not require a base conversion but may (depending on the language used) need to be explicitly converted to a string format to store it here.


The other columns will have the square of this Number in the corresponding bases.  BC(i,2) is the location for N2 in base 2 (binary).  BC(i,3) is the location for N2 in base 3. BC(i,4) is the location for N2 in base 4, etc.


There are several algorithms for converting a decimal number to base (b).

Some languages have built-in subroutines for the common Hex and Binary base conversions, and some will do any base up to base 64.  Your teacher/professor will probably want you to write your own code for these conversions.


The easiest method that’s conveniently suitable is the divide, subtract and multiply method.

Create a 20 element array to store the remainders. (The largest string will be 17 characters for the conversion of N=300; 3002 = 9000010 = 101011111100100002)


For any given base, the elements of the array will store the decimal value of each digit of base (b).  The values are stored ascending in base 10, but the implied value for each element is

[D1 * b0] [D2 * b1], [D3 * b2], [D4 * b3], [D5 * b4], ..., ect where b is the base


Here’s an example converting 71298 (the square of 267) to base 17.

You can code separate subroutines for each base, or increment an index variable for the base divisor. The process is the same for each base.  . 

This is gives a sequential overview of how the variable data in the loop would present if they were examined at each step of the loop. These are the same lines of code repeated until a zero integer is returned. It is four times for this example.   


Divide: 71298/17 = 4193.470588235 | separate the integer and fractional portions.

Subtract: 4193.470588235 -4193 = 0.470588235  | giving fractional portion

Multiply: 0.470588235 * 17 =  8  | Store in D1   (8 * 170) <-- implied base 17


Divide: 4193/17 = 246.6470588235

Subtract: 246.6470588235-246 = 0.6470588235

Multiply: 0.6470588235 * 17 = 11 | Store in D2    (11 * 171)


Divide: 246/17 = 14.47058823529

Subtract: 14.47058823529 - 14 =  0.47058823529

Multiply: 0.47058823529 * 17 = 8 | Store in D3    (8 * 172)


Divide: 14/17 = 0.82352941176

Subtract: 0.82352941176- 0 =  0.82352941176

Multiply: 0.82352941176 * 17 = 14 |store this in D2   (14 * 173)


End subroutine here if integer is (0). Then Convert and concatenate the numeric characters, then store in string array BC(N,B).  

When a value exceeds (910) A, B, C will be used in its stead.

Read values in array D(p) |where p is the index position and p=1 is the least significant digit.

Test value:

If D(p) < 10 then move D(p) to C(p) array. |IF a number less than 10 then move the number.


V=D(p) -10 on V move “A” , “B”, “C”, ect to C(p) | If a number greater than 9 then move the corresponding letter to concatenation array.


The “8” is copied as is, and 14 corresponds to “E” and 11 corresponds to “B”  

After the loop completes, reverse the string so the lesser significant digits are to the right of the more significant digits, then store in string array BC(276,17).  The language you use may have a library function to do this. The alpha-numeric number stored is E8B8


Remember to clear the temporary concatenation array after each call to the subroutine; else you will have rubbish in some of your conversions.


Go to next loop for next base, do the same bloody thing until the base is greater than 20.

Then Loop  until N > 300


After the main array is populated with the data, then it is a simple matter to look for numerical palindromes. The language you use may have a library function to reverse the string, or use the same code used in the convert and concatenate subroutine.  Compare these two strings, if they match then move the relevant data to the screen or print array  


This basic explanation of the algorithms involved may give the impression this is complicated, but this is simple to code. 







10 févr. 2019

Most of this dialogue sounds like cartoon characters speaking techno babble.


Lancelot Link Peeled Banana Productions Presents:

Bleep and Blip: All in a Daze Work


Teleplay by GingerAle 

Based on original dumbness by select members and guests of


Shanghai’d Technical Consultant: Alan

Shanghai’d Silent Technical Consultant: Rom

Shanghai’d Post Production Supervisor: Melody


Sponsored by Naus Corp: Quantum Dumbness Detection Systems  


We join the universe-saving characters in progress....


Blip: How did you do that? That number is bigger than my pecker...


Bleep: Well, it’s smaller than mine. Anyway, Blip, I used an ultra-sophisticated proprietary algorithm with ternary protocol subzero three (3) and integrand containment post zero (1) metaphase. This commutes the large number, delineating it into a unified matrix, placing the tertiary integers adjacent to each other in the first three (3) natural dimensions.


Blip: Does this index the residuals that exist in subspace? If not, then we will be leaving half our math in another universe. That would be bad!


Bleep: Ahem, yes ...I see your point. I’ll just run the numbers and algorithm through my other ultra-sophisticated computer with advanced proprietary subroutines programmed by a Martian who was educated on Zork Prime. His algorithm can actually divide by zero (0) without blowing up the universe.


Blip: That is impressive! It’s so cool that we can save the universe!


Bleep: Yes, it is. But we must keep it secret.


Blip: Why?


Bleep: Because anyone who knows anything more than the multiplication tables will make fun of us.  It will distract us from our important work.   


[Fade out scene while Blip nods in agreement.]


[Fade in:  Shrine of Organized Stupidity and Perpetual Quantum Dumbness]

Speaker: Thank you for joining us for the canonization of Aaron Traywick


Blip: Aaron was a great leader for our scientific and mathematical theories.


Bleep: Yes he was. He will be greatly missed and hard to replace.


Blip: Maybe you could replace him.


Bleep: No: I would never be appointed to such a lofty position as the Great Arron. I know my times-tables too well and I’ve squared too many numbers, which is really just the same as multiplying, but it sounds better.


Blip: What about me? I only know the ones and five times tables. 


Bleep: No Blip. Once you went past the fives times tables, you were effectively disqualified.

Ours is to work in obscurity and to support the great work of Arron T. and his successors. Maybe someday our contributions will be recognized beyond the elites of our vocation, but it will take awhile for the devolutionary processes to work on the majority population, so it may not be in our life time.


Blip: Such is the pity.


Bleep: Yes it is. 


[Fade out scene while Blip and Bleep gaze into the future, nodding.]

17 janv. 2019