{ From user Lonnie, Model Counting_challenge at 7-Oct-2016 1:49:30 PM, encoding="UTF-8" } SoftwareVersion 5.0.0 { System Variables with non-default values: } SampleSize := 1000 TypeChecking := 1 Checking := 1 SaveOptions := 2 SaveValues := 0 NodeInfo FormNode: 1,0,0,1,0,0,0,,0,0,,0,0 Model Counting_challenge Title: Counting challenge Description: In this modeling challenge, you are to write a Definition that counts in an given base. Your challenge is to fill in the Definition of Counter, so that each row along index I are the digits of I expressed in base Base. Each row will increment the previous row by 1.~ ~ By enumerating all numbers, you will have enumerated all combinations of digits. Author: Lonnie Chrisman, Ph.D.~ Lumina Decision Systems Date: Fri, Oct 7, 2016 1:30 PM SaveAuthor: Lonnie SaveDate: Fri, Oct 7, 2016 1:49 PM DiagState: 2,1,0,944,545,17 WindState: 2,417,318,720,350 FontStyle: Arial,15 FileInfo: 0,Model Counting_challenge,2,2,0,0,C:\Users\Lonnie\Documents\Analytica\Example Models\Counting challenge.ana Constant Base Title: Base Description: Specifies the base used for counting. Each digit can range from 0 to Base-1. Definition: 3 NodeLocation: 128,72,1 NodeSize: 48,24 WindState: 2,407,346,720,350 Aliases: FormNode Fo1475872278 FormNode Fo1475872278 Title: Base Definition: 0 NodeLocation: 596,56,1 NodeSize: 76,16 Original: Base Constant N_digits Title: N digits Description: The number of digits in the numbers to be enumerated. Definition: 6 NodeLocation: 128,136,1 NodeSize: 48,24 Aliases: FormNode Fo1475872302 FormNode Fo1475872302 Title: N digits Definition: 0 NodeLocation: 596,88,1 NodeSize: 76,16 Original: N_digits Index I Title: I Description: Used to index the numbers. This will be the ith index. Definition: 0 .. base ^ N_digits - 1 NodeLocation: 128,208,1 NodeSize: 48,24 Variable Counter Title: Counter Description: Your challenge is to fill in the Definition of this variable.~ ~ This variable should count in base Base. The least significant digit should cycle from 0 to Base-1, then it should cycle back to 0 are carry one to the next digit, and so on. For example, counting in base 3:~ ~ 000000~ 000001~ 000002~ 000010~ 000011~ 000012~ 000100~ 000101~ ...~ NodeLocation: 272,72,1 NodeSize: 48,24 WindState: 2,390,200,720,518 ValueState: 2,620,24,517,585,,MIDM ReformVal: [Digit,I] Index Digit Title: Digit Description: Indexes the digits of each number. 0 should be the least-significant (fastest varying) digit. Definition: N_digits-1 .. 0 NodeLocation: 128,272,1 NodeSize: 48,24 Variable Desired_result_for_C Title: Desired result for Counter Description: The result of this variable shows you the desired solution. Your Definition for the variable Counter should compute this same result. Definition: Mod( Floor(I / Base^Digit), Base ) NodeLocation: 272,160,1 NodeSize: 48,32 NodeInfo: 1,0,1,1,1,1,0,,0,,0,,, WindState: 2,425,372,720,350 ValueState: 2,389,177,674,509,,MIDM ReformVal: [Digit,I] Att__CloakDefn: 1 Module Solution___don_t_pee Title: Solution - don't peek Description: One possible solution is shown inside this module. Don't peek until you've found a solution yourself! NodeLocation: 128,368,1 NodeSize: 56,24 DiagState: 2,429,290,594,309,17 Variable Solution Title: Solution Definition: Mod( Floor(I / Base^Digit), Base ) NodeLocation: 112,72,1 NodeSize: 48,24 ValueState: 2,450,110,527,557,,MIDM ReformVal: [Digit,I] Close Solution___don_t_pee Close Counting_challenge