Showing posts with label Integers. Show all posts
Showing posts with label Integers. Show all posts

Saturday, June 11, 2016

Exploring Mersenne primes 2^p -1

Just a note:
My app "Touch Integers ℤ (+ - × ÷)" is useful to explore the Mersenne primes:
Here there's a tiny exploration from 2^2 -1 to 2^23 -1.
We found all numbers prime, except when p==11 and p==23
Like everybody knows:

The search is made with:  "Touch Integers ℤ (+ - × ÷)" Android app:
http://www.nummolt.com

///////     UPDATE:  (August 2016)    ////////
Same exploration on Wagstaff Prime Numbers:  
 

 Woodall Primes:
 
     

Euler's Lucky numbers:

 
   

And Goldbach's Conjecture:
 
 


The exploration has been made with:  "Touch Integers ℤ (+ - × ÷)" Android app:
http://www.nummolt.com


Tuesday, November 10, 2015

Touch Integers ℤ (+ - × ÷)

Touch Integers is the evolution of the Touch decimals Place value ±. (in the same blog)
Touch decimals could not easily multiply or divide numbers:


I've started my reflections about this 20 years ago:
Is very easy add and subtract graphically. One can regroup the tokens of each order, regroup, carry or borrow tokens, and you can obtain the result in a simulation of abacus.


But not so easy to practice multiplication or division in this visual and interactive way

I looked the inside of the numbers:

Inside the numbers there are the components of the number: The prime factors.

To multiply two integers you must regroup the components of the two numbers.

To divide a integer, you must separate the components.

The program only works with integers. adds, subtract, multiplies and divides (but only exact division) 

Is my latest Android App: 




At Google Play: 
https://play.google.com/store/apps/details?id=com.nummolt.touch.integers

I hope you will find it useful for teaching.

Some animations:

At left: two abacuses (two numbers stacked). 
At right two circles with the prime factors. (two circles with prime numbers stacked)
At right edge: all the prime numbers available to the app. 

To create a number:  Tap on the cells at left. The app shows the number
To add: Drag the tokens from one abacus to the other.
To subtract: Tap the sign key and drag from one abacus to the other.
To multiply: (the numbers must be previously created with the earlier previous steps)
Drag from one prime circle to the other prime circle.
To Divide a number:
Drag the prime numbers outside the prime circle:
Release prime factors to the other prime circle (integer division and multiplication) 
Release prime factors between the prime circles (integer division)
Release prime factors in the list of the right edge: (integer division and erase the prime factor)
Scroll and pick a prime number from the list of the right edge:

And release it in the free zone, or in a prime circle (multiplication) 

Playing with 12*12:


Creating two prime numbers: 
Multiply them. 
Restoring to the original state.
Throwing the prime numbers to the primes list. 



Picking numbers from the big list of prime numbers:
Playing with 2; 3; 5; 7; 11; 13.
1001; 30 and 30,030


(In the current version the top prime number available is 19,874,419)


Multiplication Table with Prime Numbers made with elements from Touch Integers:
 
Multiplication Table

 



///////////////////////////////////////////////////ACKNOWLEDGEMENTS///////////////////////////////////////////////////////




Jacobo Bulaewsky: (Arcytech.com (broken)) (12/08/1955 - 08/25/2004)

Brian Sutherland: ( http://www.our-montessori.ca ) Montessori methods adapted to computer. 
(Shockwave Player activities: covering addition, subtraction, multiplication and division) 
Long multiplication: https://www.youtube.com/watch?v=qDMXNjtuqqo
Long division: https://www.youtube.com/watch?v=seJC-1BR_gQ 

Agustín Rayo: (Philosopy professor at MIT) 
And his article about the Prime Numbers, at Scientific American (Spanish version - 02/2010)):

"Ladrillos, candados y progresiones.
El fabuooso mundo de los números primos".


Ulrich Kortenkamp: (Professor für Didaktik der Mathematik. Universität Potsdam. 
Author of "Place Value Chart" and "Cinderella") http://kortenkamps.net/index.php/Hauptseite 
Place Value Chart: Web page: Stellenwerttafel: http://kortenkamps.net/index.php/Stellenwerttafel








Wendy Petti (Teacher and author of MathCats): http://www.mathcats.com 
Nearly 20 years of support and patience with me. And specially for the vision about the position of the places in "Touch decimals Place value ±" which allowed continuing the work well.
Our first work as a team: OBBL Architecture blocks: http://www.mathcats.com/explore/obbl/obbl.html
And "Place Value Party Cake":



Jeff LeMieux: (Builder, teacher along 35 years and software developer) 
Scripts Web Page: http://syzygy.virtualave.net/
For his work and the assistance in the development of Touch Decimals: Option without negative numbers.


Joan Jareño (From: CREAMAT team) http://srvcnpbs.xtec.cat/creamat/joomla/ 
And History of numbers: Calculus: http://xtec.cat/~jjareno/calculus/
For their help in the last steps in the development of "Touch Integers".
* * *

Added later:
Playing with the app "Touch Integers ℤ (+ - × ÷)":
Exploring Mersenne primes: 2^p -1 (Not all are primes) 
nummolt.blogspot.com/2016/06/exploring-mersenne-primes-2p-1.html
https://www.youtube.com/watch?v=sOnkpDihIS4



  

Saturday, October 31, 2015

Dancing Sort Algorithms

Post, only to illustrate the most common types of sorting algorithms:
Graphically, Dance, and Code:

(Graphic from http://www.sorting-algorithms.com/ )
(Videos from: https://www.youtube.com/user/AlgoRythmics )
(Pseudocode: http://visualgo.net/ )
(Pseudocode Shell: https://courses.cs.washington.edu/courses/cse326/03wi/lectures/RaoLect14.pdf )
(Main Links (titles): Wikipedia: https://en.wikipedia.org/wiki/Sorting_algorithm

Sorting Algorithms general animated image:
(Algorithms race)



1.-  Insert:

mark first element as sorted
for each unsorted element
  'extract' the element
  for i = lastSortedIndex to 0
    if currentSortedElement > extractedElement
      move sorted element to the right by 1
    else: insert extracted element



2.- Select:

repeat (numOfElements - 1) times
  set the first unsorted element as the minimum
  for each of the unsorted elements
    if element < currentMinimum
      set element as new minimum
  swap minimum with first unsorted position



3.- Bubble:

do
  swapped = false
  for i = 1 to indexOfLastUnsortedElement
    if leftElement > rightElement
      swap(leftElement, rightElement)
      swapped = true
while swapped


4.- Shell:

                                # Start with the largest gap and work down to a gap of 1
                                     foreach (gap in gaps){
                                # Do a gapped insertion sort for this gap size.
                                                     # The first gap elements a[0..gap-1] are already in gapped order
                                                     # keep adding one more element until the entire array is gap sorted  
                                     for (i = gap; i < n; i += 1){
                                            temp = a[i]
                                            for (j = i; j >= gap and a[j - gap] > temp; j -= gap){
                                                  a[j] = a[j - gap]
                                            }
                                            a[j] = temp
                                      }
                                }


5.- Merge:

split each element into partitions of size 1
recursively merge adjancent partitions
  for i = leftPartStartIndex to rightPartLastIndex inclusive
    if leftPartHeadValue <= rightPartHeadValue
      copy leftPartHeadValue
    else: copy rightPartHeadValue
copy elements back to original array


7.- Quick:

for each (unsorted) partition
  set first element as pivot
  storeIndex = pivotIndex + 1
  for i = pivotIndex + 1 to rightmostIndex
    if element[i] < element[pivot]
      swap(i, storeIndex); storeIndex++
  swap(pivot, storeIndex - 1)