Home Forums Actuarial Resources & Blogs Ahnentafel computer program

Viewing 1 post (of 1 total)
• Author
Posts
• #25177
Richard Purvey
Participant

A computer program to list the ancestral ahnentafel position numbers, going back G generations, as well as the descendant ahnentafel position numbers, for ahnentafel position number X

The computer program below will calculate and display all of the ancestral ahnentafel position numbers (AAPNs), going back G generations, for ahnentafel position number X, and then will calculate and display all of the descendant ahnentafel position numbers (DAPNs) for ahnentafel position number X.  Finally, as a bonus, the program will state the parental sequence for ahnentafel position number X in terms of ahnentafel position number 1.

For example, all of the ancestral ahnentafel position numbers (AAPNs), going back 2 generations, for ahnentafel position number 9 are 18 19 and 36 37 38 39, while all of the descendant ahnentafel position numbers (DAPNs) for ahnentafel position number 9 are 4 2 1.  The parental sequence for ahnentafel position number 9 in terms of ahnentafel position number 1 is father’s father’s mother (the program will state this as FATH FATH MOTH).

10 INPUT X, G

20 C=X

30 IF G=0 THEN GOTO 110

40 PRINT “THE AAPNs GOING BACK “;G;” GENERATIONS FOR APN “;X;” ARE:”

50 FOR Y=1 TO G

60 FOR Z=0 TO 2^Y-1

70 PRINT 2^Y*X+Z

80 NEXT Z

90 PRINT “ “

100 NEXT Y

110 D=C

120 IF C=1 THEN END

130 PRINT “THE DAPNs FOR APN “;C;” ARE:”

140 B=0

150 A=INT(LN(C)/LN(2))

160 DIM NUM\$(A)

170 IF C=1 THEN GOTO 230

180 B=B+1

190 IF C/2=INT(C/2) THEN NUM\$(A+1-B)=”FATH” ELSE NUM\$(A+1-B)=”MOTH”

200 C=INT(C/2)

210 PRINT C

220 GOTO 170

230 PRINT “THE PARENTAL SEQUENCE FOR APN “;D;” IN TERMS OF APN 1 IS:”

240 FOR X=1 TO A

250 PRINT NUM\$(X)

260 NEXT X

Richard Purvey June 2024

Viewing 1 post (of 1 total)
• You must be logged in to reply to this topic.