Saturday, November 27, 2021

Casio fx-CG50: Integer Digit Operations

Casio fx-CG50: Integer Digit Operations


Sum of the Digits and Digital Sum with Memory


The sum of the digits is pretty much a straight forward calculation, separate all the digits and add them up.  Example:


N = 18,283


Sum of the digits: S = 1 + 8 + 2 + 8 + 3 = 22


Ernesto Estrada, author of the article "Integer-Digit Functions: An Example of Math-Art Integration" (see the Source Section below), introduces the sum of the digits with memory, which is defined as:


F = N × S 


Going with our example, N = 18,283.  With S = 22,


F = 18,283 × 22 = 402,226


The program INTDGT, programmed on the Casio fx-CG50, calculates the sum of a digits of a positive integer and the digital sum of the memory.


Variables:

N = input

S = sum of the digits

F = digital sum with memory

List 1 = list where each element is a digit of N


Casio fx-CG50 Program:  INTDGT


"2021-09-21 EWS"

"N>0, INTEGER "? → N

N → A

Int log N → L

Seq(0,x,0,L,1) → List 1

For 1 → K To L+1

Int (A÷10^L) → List 1[K]

A-List 1[K]×10^L → A

L-1 → L

Next

Sum List 1→ S

S×N → F

"SUM OF DIGITS="

S ◢

"S×N="

F ◢

"DIGITS IN List 1"

List 1


Sum of Digits as Functions Applied to Each Digit


The program FNDGT calculates the sum of each digit and returns a list in a four element list:


{ Σ (n_k),  Σ (n_k)^2,  Σ sin(n_k), Σ cos(n_k) }


Radians angle mode is used.  The results are stored in List 2.


Casio fx-CG50 Program:  FNDGT


"2021-09-21 EWS"

Rad

"N>0, INTEGER"? → N

N → A

Int log N → L

{0,0,0,0} → List 2

For L → K To 0 Step -1

Int (A÷10^K) → M

List 2[1] + M → List 2[1]

List 2[2] + M^2 → List 2[2]

List 2[3] + sin M → List 2[3]

List 2[4] + cos M → List 2[4]

A - M×10^K → A

Next

"K, K^2, sin K, cos K" ◢

List 2


Example: 

N = 93,259


Results:

{ 28, 200, 0.9157301307, -2.944737671 }


Integers and Art


I encourage everyone to read the article listed in the source section below.   Ernesto Estrada demonstrates how to turn the sum of a digits and applying functions to the digits into beautiful art:   grass, fish, asteroids, butterflies, and other beautiful patterns.  If you have the chance, get this article while it is Open Access!  


Source:


Estrada, Ernesto  "Integer-Digit Functions:  An Example of Math-Art Integration"  The Authors, Volume 40, Number 1, 2018.   https://link.springer.com/article/10.1007%2Fs00283-017-9726-x

Retrieved September 15, 2021.   Open Access*


*as of 9/15/2021 


In a few days the 2021 calendar will just be one page.


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


No comments:

Post a Comment

Numworks Update 17.2 - Highlights

 Numworks Update 17.2 - Highlights Update is available at: https://www.numworks.com/ The Numworks website will detect your calculator and wi...