Abundant odd numbers

From Rosetta Code
Task
Abundant odd numbers
You are encouraged to solve this task according to the task description, using any language you may know.

An Abundant number is a number n for which the   sum of divisors   σ(n) > 2n,
or,   equivalently,   the   sum of proper divisors   (or aliquot sum)       s(n) > n.


E.G.

12   is abundant, it has the proper divisors     1,2,3,4 & 6     which sum to   16   ( > 12 or n);
       or alternately,   has the sigma sum of   1,2,3,4,6 & 12   which sum to   28   ( > 24 or 2n).


Abundant numbers are common, though even abundant numbers seem to be much more common than odd abundant numbers.

To make things more interesting, this task is specifically about finding   odd abundant numbers.


Task
  • Find and display here: at least the first 25 abundant odd numbers and either their proper divisor sum or sigma sum.
  • Find and display here: the one thousandth abundant odd number and either its proper divisor sum or sigma sum.
  • Find and display here: the first abundant odd number greater than one billion (109) and either its proper divisor sum or sigma sum.


References



11l[edit]

Translation of: Python
V oddNumber = 1
V aCount = 0
V dSum = 0

F divisorSum(n)
   V sum = 1
   V i = Int(sqrt(n) + 1)

   L(d) 2 .< i
      I n % d == 0
         sum += d
         V otherD = n I/ d
         I otherD != d
            sum += otherD
   R sum

print(‘The first 25 abundant odd numbers:’)
L aCount < 25
   dSum = divisorSum(oddNumber)
   I dSum > oddNumber
      aCount++
      print(‘#5 proper divisor sum: #.’.format(oddNumber, dSum))
   oddNumber += 2

L aCount < 1000
   dSum = divisorSum(oddNumber)
   I dSum > oddNumber
      aCount++
   oddNumber += 2
print("\n1000th abundant odd number:")
print(‘     ’(oddNumber - 2)‘  proper divisor sum:  ’dSum)

oddNumber = 1000000001
V found = 0B
L !found
   dSum = divisorSum(oddNumber)
   I dSum > oddNumber
      found = 1B
      print("\nFirst abundant odd number > 1 000 000 000:")
      print(‘     ’oddNumber‘  proper divisor sum:  ’dSum)
   oddNumber += 2
Output:
The first 25 abundant odd numbers:
  945 proper divisor sum: 975
 1575 proper divisor sum: 1649
 2205 proper divisor sum: 2241
 2835 proper divisor sum: 2973
 3465 proper divisor sum: 4023
 4095 proper divisor sum: 4641
 4725 proper divisor sum: 5195
 5355 proper divisor sum: 5877
 5775 proper divisor sum: 6129
 5985 proper divisor sum: 6495
 6435 proper divisor sum: 6669
 6615 proper divisor sum: 7065
 6825 proper divisor sum: 7063
 7245 proper divisor sum: 7731
 7425 proper divisor sum: 7455
 7875 proper divisor sum: 8349
 8085 proper divisor sum: 8331
 8415 proper divisor sum: 8433
 8505 proper divisor sum: 8967
 8925 proper divisor sum: 8931
 9135 proper divisor sum: 9585
 9555 proper divisor sum: 9597
 9765 proper divisor sum: 10203
10395 proper divisor sum: 12645
11025 proper divisor sum: 11946

1000th abundant odd number:
     492975  proper divisor sum:  519361

First abundant odd number > 1 000 000 000:
     1000000575  proper divisor sum:  1083561009

360 Assembly[edit]

*        Abundant odd numbers      18/09/2019
ABUNODDS CSECT
         USING  ABUNODDS,R13       base register
         B      72(R15)            skip savearea
         DC     17F'0'             savearea
         SAVE   (14,12)            save previous context
         ST     R13,4(R15)         link backward
         ST     R15,8(R13)         link forward
         LR     R13,R15            set addressability
         LA     R8,0               n=0 
         LA     R6,3               i=3 
       DO WHILE=(C,R8,LT,NN1)      do i=3 by 2 until n>=nn1 
         BAL    R14,SIGMA            s=sigma(i)
       IF    CR,R9,GT,R6 THEN        if s>i then
         LA     R8,1(R8)               n++
         BAL    R14,PRINT              print results
       ENDIF    ,                    endif
         LA     R6,2(R6)             i+=2 
       ENDDO    ,                  enddo i
         LA     R8,0               n=0 
         LA     R6,3               i=3 
         XR     R1,R1              f=false 
       DO WHILE=(C,R1,EQ,=F'0')    do i=3 by 2 while not f
         BAL    R14,SIGMA            s=sigma(i)
       IF    CR,R9,GT,R6 THEN        if s>i then
         LA     R8,1(R8)               n++
       IF      C,R8,GE,NN2 THEN        if n>=nn2 then
         BAL    R14,PRINT                print results
         LA     R1,1                     f=true
       ENDIF    ,                      endif
       ENDIF    ,                    endif
         LA     R6,2(R6)             i+=2
       ENDDO    ,                  enddo i
         LA     R8,0               n=0 
         L      R6,NN3             i=mm3 
         LA     R6,1(R6)           +1
         XR     R1,R1              f=false 
       DO WHILE=(C,R1,EQ,=F'0')    do i=nn3+1 by 2 while not f
         BAL    R14,SIGMA            s=sigma(i)
       IF    CR,R9,GT,R6 THEN        if s>i then
         BAL    R14,PRINT              print results
         LA     R1,1                   f=true
       ENDIF    ,                    endif
         LA     R6,2(R6)             i+=2
       ENDDO    ,                  enddo i
         L      R13,4(0,R13)       restore previous savearea pointer
         RETURN (14,12),RC=0       restore registers from calling save
SIGMA    CNOP   0,4                ---- subroutine sigma
         LA     R9,1               s=1
         LA     R7,3               j=3 
         LR     R5,R7              j
         MR     R4,R7              j*j
       DO WHILE=(CR,R5,LT,R6)      do j=3 by 2 while j*j<i 
         LR     R4,R6                i
         SRDA   R4,32                ~
         DR     R4,R7                i/j
       IF   LTR,R4,Z,R4 THEN         if mod(i,j)=0 then
         AR     R9,R7                  s+j
         LR     R4,R6                  i
         SRDA   R4,32                  ~
         DR     R4,R7                  i/j
         AR     R9,R5                  s=s+j+i/j
       ENDIF    ,                    endif
         LA     R7,2(R7)             j+=2 
         LR     R5,R7                j
         MR     R4,R7                j*j
       ENDDO    ,                  enddo j
       IF    CR,R5,EQ,R6 THEN      if j*j=i then
         AR     R9,R7              s=s+j
       ENDIF    ,                  endif
         BR     R14                ---- end of subroutine sigma
PRINT    CNOP   0,4                ---- subroutine print
         XDECO  R8,XDEC            edit n
         MVC    BUF(4),XDEC+8      output n
         XDECO  R6,BUF+14          edit & output i
         XDECO  R9,BUF+33          edit & output s
         XPRNT  BUF,L'BUF          print buffer
         BR     R14                ---- end of subroutine print
NN1      DC     F'25'              nn1=25
NN2      DC     F'1000'            nn2=1000
NN3      DC     F'1000000000'      nn3=1000000000
BUF      DC     CL80'.... - number=............ sigma=............'
XDEC     DS     CL12               temp for edit
         REGEQU                    equate registers
         END    ABUNODDS
Output:
   1 - number=         945 sigma=         975
   2 - number=        1575 sigma=        1649
   3 - number=        2205 sigma=        2241
   4 - number=        2835 sigma=        2973
   5 - number=        3465 sigma=        4023
   6 - number=        4095 sigma=        4641
   7 - number=        4725 sigma=        5195
   8 - number=        5355 sigma=        5877
   9 - number=        5775 sigma=        6129
  10 - number=        5985 sigma=        6495
  11 - number=        6435 sigma=        6669
  12 - number=        6615 sigma=        7065
  13 - number=        6825 sigma=        7063
  14 - number=        7245 sigma=        7731
  15 - number=        7425 sigma=        7455
  16 - number=        7875 sigma=        8349
  17 - number=        8085 sigma=        8331
  18 - number=        8415 sigma=        8433
  19 - number=        8505 sigma=        8967
  20 - number=        8925 sigma=        8931
  21 - number=        9135 sigma=        9585
  22 - number=        9555 sigma=        9597
  23 - number=        9765 sigma=       10203
  24 - number=       10395 sigma=       12645
  25 - number=       11025 sigma=       11946
1000 - number=      492975 sigma=      519361
   0 - number=  1000000575 sigma=  1083561009

AArch64 Assembly[edit]

Works with: as version Raspberry Pi 3B version Buster 64 bits
or android 64 bits with application Termux
/* ARM assembly AARCH64 Raspberry PI 3B or android 64 bits */
/* program abundant64.s   */
 
/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
 
.equ NBDIVISORS,             1000
 
/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szMessStartPgm:          .asciz "Program start \n"
szMessEndPgm:            .asciz "Program normal end.\n"
szMessErrorArea:         .asciz "\033[31mError : area divisors too small.\n"
szMessError:             .asciz "\033[31mError  !!!\n"
szMessErrGen:            .asciz "Error end program.\n"
szMessNbPrem:            .asciz "This number is prime !!!.\n"
szMessOverflow:          .asciz "Dépassement de capacité vérification premier.\n"
szMessResultFact:        .asciz "// "
 
szCarriageReturn:        .asciz "\n"
 
/* datas message display */
szMessEntete:            .asciz "The first 25 abundant odd numbers are:\n"
szMessResult:            .asciz "Number : @  sum : @ \n"
 
szMessEntete1:           .asciz "The 1000 odd abundant number :\n"
szMessEntete2:           .asciz "First odd abundant number > 1000000000 :\n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss 
.align 4
sZoneConv:               .skip 24
tbZoneDecom:             .skip 16 * NBDIVISORS       // facteur 8 octets nombre 8 octets
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main 
main:                               // program start
    ldr x0,qAdrszMessStartPgm       // display start message
    bl affichageMess
 
    ldr x0,qAdrszMessEntete         // display result message
    bl affichageMess
    mov x2,#1
    mov x3,#0
1:
    mov x0,x2                       //  number
    bl testAbundant
    cmp x0,#1
    bne 3f
    add x3,x3,#1
    mov x0,x2
    mov x4,x1                        // save sum
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc               // and put in message
    mov x5,x0
    mov x0,x4                        // sum 
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    mov x0,x5
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc               // and put in message
 
    bl affichageMess
3:
    add x2,x2,#2
    cmp x3,#25
    blt 1b
 
    /* 1000 abundant number  */
    ldr x0,qAdrszMessEntete1
    bl affichageMess
    mov x2,#1
    mov x3,#0
4:
    mov x0,x2                       //  number
    bl testAbundant
    cmp x0,#1
    bne 6f
    add x3,x3,#1
6:
    cmp x3,#1000
    cinc x2,x2,lt                    // add two
    cinc x2,x2,lt
    blt 4b
    mov x0,x2
    mov x4,x1                        // save sum
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc               // and put in message
    mov x5,x0
    mov x0,x4                        // sum 
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    mov x0,x5
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc                // and put in message
 
    bl affichageMess
 
    /* abundant number>1000000000   */
    ldr x0,qAdrszMessEntete2
    bl affichageMess
    ldr x2,iN10P9
    add x2,x2,#1
    mov x3,#0
7:
    mov x0,x2                       //  number
    bl testAbundant
    cmp x0,#1
    beq 8f
    add x2,x2,#2
    b 7b
8:
    mov x0,x2
    mov x4,x1                        // save sum
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc               // and put in message
    mov x5,x0
    mov x0,x4                        // sum 
    ldr x1,qAdrsZoneConv
    bl conversion10                  // convert ascii string
    mov x0,x5
    ldr x1,qAdrsZoneConv
    bl strInsertAtCharInc                // and put in message
 
    bl affichageMess
 
 
 
    ldr x0,qAdrszMessEndPgm         // display end message
    bl affichageMess
    b 100f
99:                                 // display error message 
    ldr x0,qAdrszMessError
    bl affichageMess
100:                                // standard end of the program
    mov x0, #0                      // return code
    mov x8, #EXIT                   // request to exit program
    svc 0                           // perform system call
qAdrszMessStartPgm:        .quad szMessStartPgm
qAdrszMessEndPgm:          .quad szMessEndPgm
qAdrszMessError:           .quad szMessError
qAdrszCarriageReturn:      .quad szCarriageReturn
qAdrtbZoneDecom:           .quad tbZoneDecom
qAdrszMessEntete:          .quad szMessEntete
qAdrszMessEntete1:         .quad szMessEntete1
qAdrszMessEntete2:         .quad szMessEntete2
qAdrszMessResult:          .quad szMessResult
qAdrsZoneConv:             .quad sZoneConv
iN10P9:                    .quad 1000000000
/******************************************************************/
/*     test if number is abundant number                         */ 
/******************************************************************/
/* x0 contains the number  */
/* x0 return 1 if abundant number else return 0  */
/* x1 return sum                                 */
testAbundant:
    stp x2,lr,[sp,-16]!         // save  registres
    stp x3,x4,[sp,-16]!         // save  registres
    stp x5,x6,[sp,-16]!         // save  registres
    mov x6,x0                    // save number
    ldr x1,qAdrtbZoneDecom
    bl decompFact                // create area of divisors
    cmp x0,#1                    // no divisors
    ble 99f
    lsl x5,x6,#1                 // abondant number ?
    cmp x5,x2
    bgt 99f                     // no -> end
    mov x0,#1
    sub x1,x2,x6                 // sum
    b 100f
99:
    mov x0,0
100:
    ldp x5,x6,[sp],16         // restaur des  2 registres
    ldp x3,x4,[sp],16         // restaur des  2 registres
    ldp x2,lr,[sp],16         // restaur des  2 registres
    ret
/******************************************************************/
/*     decomposition en facteur                                               */ 
/******************************************************************/
/* x0 contient le nombre à decomposer */
decompFact:
    stp x3,lr,[sp,-16]!        // save  registres
    stp x4,x5,[sp,-16]!        // save  registres
    stp x6,x7,[sp,-16]!        // save  registres
    stp x8,x9,[sp,-16]!        // save  registres
    stp x10,x11,[sp,-16]!        // save  registres
    mov x5,x1
    mov x8,x0                    // save number
    bl isPrime                   // prime ?
    cmp x0,#1
    beq 98f                      // yes is prime
    mov x1,#1
    str x1,[x5]                  // first factor
    mov x12,#1                   // divisors sum
    mov x11,#1                   // number odd divisors
    mov x4,#1                    // indice divisors table
    mov x1,#2                    // first divisor
    mov x6,#0                    // previous divisor
    mov x7,#0                    // number of same divisors
2:
    mov x0,x8                    // dividende
    udiv x2,x0,x1                //  x1 divisor x2 quotient x3 remainder
    msub x3,x2,x1,x0
    cmp x3,#0
    bne 5f                       // if remainder <> zero  -> no divisor
    mov x8,x2                    // else quotient -> new dividende
    cmp x1,x6                    // same divisor ?
    beq 4f                       // yes
    mov x7,x4                    // number factors in table
    mov x9,#0                    // indice
21:
    ldr x10,[x5,x9,lsl #3 ]      // load one factor
    mul x10,x1,x10               // multiply 
    str x10,[x5,x7,lsl #3]       // and store in the table
    tst x10,#1                   // divisor odd ?
    cinc x11,x11,ne
    add x12,x12,x10
    add x7,x7,#1                 // and increment counter
    add x9,x9,#1
    cmp x9,x4  
    blt 21b
    mov x4,x7
    mov x6,x1                    // new divisor
    b 7f
4:                               // same divisor
    sub x9,x4,#1
    mov x7,x4
41:
    ldr x10,[x5,x9,lsl #3 ]
    cmp x10,x1
    sub x13,x9,1
    csel x9,x13,x9,ne
    bne 41b
    sub x9,x4,x9
42:
    ldr  x10,[x5,x9,lsl #3 ]
    mul x10,x1,x10
    str x10,[x5,x7,lsl #3]       // and store in the table
    tst x10,#1                   // divsor odd ?
    cinc  x11,x11,ne
    add x12,x12,x10
    add x7,x7,#1                 // and increment counter
    add x9,x9,#1
    cmp x9,x4  
    blt 42b
    mov x4,x7
    b 7f                         // and loop
 
    /* not divisor -> increment next divisor */
5:
    cmp x1,#2                    // if divisor = 2 -> add 1 
    add x13,x1,#1                // add 1
    add x14,x1,#2                // else add 2
    csel x1,x13,x14,eq
    b 2b
 
    /* divisor -> test if new dividende is prime */
7: 
    mov x3,x1                    // save divisor
    cmp x8,#1                    // dividende = 1 ? -> end
    beq 10f
    mov x0,x8                    // new dividende is prime ?
    mov x1,#0
    bl isPrime                   // the new dividende is prime ?
    cmp x0,#1
    bne 10f                      // the new dividende is not prime
 
    cmp x8,x6                    // else dividende is same divisor ?
    beq 9f                       // yes
    mov x7,x4                    // number factors in table
    mov x9,#0                    // indice
71:
    ldr x10,[x5,x9,lsl #3 ]      // load one factor
    mul x10,x8,x10               // multiply 
    str x10,[x5,x7,lsl #3]       // and store in the table
    tst x10,#1                   // divsor odd ?
    cinc x11,x11,ne
    add x12,x12,x10
    add x7,x7,#1                 // and increment counter
    add x9,x9,#1
    cmp x9,x4  
    blt 71b
    mov x4,x7
    mov x7,#0
    b 11f
9:
    sub x9,x4,#1
    mov x7,x4
91:
    ldr x10,[x5,x9,lsl #3 ]
    cmp x10,x8
    sub x13,x9,#1
    csel x9,x13,x9,ne
    bne 91b
    sub x9,x4,x9
92:
    ldr  x10,[x5,x9,lsl #3 ]
    mul x10,x8,x10
    str x10,[x5,x7,lsl #3]       // and store in the table
    tst x10,#1                   // divisor odd ?
    cinc x11,x11,ne
    add x12,x12,x10
    add x7,x7,#1                 // and increment counter
    add x9,x9,#1
    cmp x9,x4  
    blt 92b
    mov x4,x7
    b 11f
 
10:
    mov x1,x3                    // current divisor = new divisor
    cmp x1,x8                    // current divisor  > new dividende ?
    ble 2b                       // no -> loop
 
    /* end decomposition */ 
11:
    mov x0,x4                    // return number of table items
    mov x2,x12                   // return sum 
    mov x1,x11                   // return number of odd divisor 
    mov x3,#0
    str x3,[x5,x4,lsl #3]        // store zéro in last table item
    b 100f
 
 
98: 
    //ldr x0,qAdrszMessNbPrem
    //bl   affichageMess
    mov x0,#1                   // return code
    b 100f
99:
    ldr x0,qAdrszMessError
    bl   affichageMess
    mov x0,#-1                  // error code
    b 100f


100:
    ldp x10,x11,[sp],16          // restaur des  2 registres
    ldp x8,x9,[sp],16          // restaur des  2 registres
    ldp x6,x7,[sp],16          // restaur des  2 registres
    ldp x4,x5,[sp],16          // restaur des  2 registres
    ldp x3,lr,[sp],16          // restaur des  2 registres
    ret                        // retour adresse lr x30
qAdrszMessErrGen:          .quad szMessErrGen
qAdrszMessNbPrem:          .quad szMessNbPrem
/***************************************************/
/*   Verification si un nombre est premier         */
/***************************************************/
/* x0 contient le nombre à verifier */
/* x0 retourne 1 si premier  0 sinon */
isPrime:
    stp x1,lr,[sp,-16]!        // save  registres
    stp x2,x3,[sp,-16]!        // save  registres
    mov x2,x0
    sub x1,x0,#1
    cmp x2,0
    beq 99f                    // retourne zéro
    cmp x2,2                   // pour 1 et 2 retourne 1
    ble 2f
    mov x0,#2
    bl moduloPux64
    bcs 100f                   // erreur overflow
    cmp x0,#1
    bne 99f                    // Pas premier
    cmp x2,3
    beq 2f
    mov x0,#3
    bl moduloPux64
    blt 100f                   // erreur overflow
    cmp x0,#1
    bne 99f

    cmp x2,5
    beq 2f
    mov x0,#5
    bl moduloPux64
    bcs 100f                   // erreur overflow
    cmp x0,#1
    bne 99f                    // Pas premier

    cmp x2,7
    beq 2f
    mov x0,#7
    bl moduloPux64
    bcs 100f                   // erreur overflow
    cmp x0,#1
    bne 99f                    // Pas premier

    cmp x2,11
    beq 2f
    mov x0,#11
    bl moduloPux64
    bcs 100f                   // erreur overflow
    cmp x0,#1
    bne 99f                    // Pas premier

    cmp x2,13
    beq 2f
    mov x0,#13
    bl moduloPux64
    bcs 100f                   // erreur overflow
    cmp x0,#1
    bne 99f                    // Pas premier
2:
    cmn x0,0                   // carry à zero pas d'erreur
    mov x0,1                   // premier
    b 100f
99:
    cmn x0,0                   // carry à zero pas d'erreur
    mov x0,#0                  // Pas premier
100:
    ldp x2,x3,[sp],16          // restaur des  2 registres
    ldp x1,lr,[sp],16          // restaur des  2 registres
    ret                        // retour adresse lr x30

/**************************************************************/
/********************************************************/
/*   Calcul modulo de b puissance e modulo m  */
/*    Exemple 4 puissance 13 modulo 497 = 445         */
/********************************************************/
/* x0  nombre  */
/* x1 exposant */
/* x2 modulo   */
moduloPux64:
    stp x1,lr,[sp,-16]!        // save  registres
    stp x3,x4,[sp,-16]!        // save  registres
    stp x5,x6,[sp,-16]!        // save  registres
    stp x7,x8,[sp,-16]!        // save  registres
    stp x9,x10,[sp,-16]!        // save  registres
    cbz x0,100f
    cbz x1,100f
    mov x8,x0
    mov x7,x1
    mov x6,1                   // resultat
    udiv x4,x8,x2
    msub x9,x4,x2,x8           // contient le reste
1:
    tst x7,1
    beq 2f
    mul x4,x9,x6
    umulh x5,x9,x6
    //cbnz x5,99f
    mov x6,x4
    mov x0,x6
    mov x1,x5
    bl divisionReg128U
    cbnz x1,99f                // overflow
    mov x6,x3
2:
    mul x8,x9,x9
    umulh x5,x9,x9
    mov x0,x8
    mov x1,x5
    bl divisionReg128U
    cbnz x1,99f                // overflow
    mov x9,x3
    lsr x7,x7,1
    cbnz x7,1b
    mov x0,x6                  // result
    cmn x0,0                   // carry à zero pas d'erreur
    b 100f
99:
    ldr x1,qAdrszMessOverflow
    bl   afficheErreur
    cmp x0,0                   // carry à un car erreur
    mov x0,-1                  // code erreur

100:
    ldp x9,x10,[sp],16          // restaur des  2 registres
    ldp x7,x8,[sp],16          // restaur des  2 registres
    ldp x5,x6,[sp],16          // restaur des  2 registres
    ldp x3,x4,[sp],16          // restaur des  2 registres
    ldp x1,lr,[sp],16          // restaur des  2 registres
    ret                        // retour adresse lr x30
qAdrszMessOverflow:         .quad  szMessOverflow
/***************************************************/
/*   division d un nombre de 128 bits par un nombre de 64 bits */
/***************************************************/
/* x0 contient partie basse dividende */
/* x1 contient partie haute dividente */
/* x2 contient le diviseur */
/* x0 retourne partie basse quotient */
/* x1 retourne partie haute quotient */
/* x3 retourne le reste */
divisionReg128U:
    stp x6,lr,[sp,-16]!        // save  registres
    stp x4,x5,[sp,-16]!        // save  registres
    mov x5,#0                  // raz du reste R
    mov x3,#128                // compteur de boucle
    mov x4,#0                  // dernier bit
1:    
    lsl x5,x5,#1               // on decale le reste de 1
    tst x1,1<<63               // test du bit le plus à gauche
    lsl x1,x1,#1               // on decale la partie haute du quotient de 1
    beq 2f
    orr  x5,x5,#1              // et on le pousse dans le reste R
2:
    tst x0,1<<63
    lsl x0,x0,#1               // puis on decale la partie basse 
    beq 3f
    orr x1,x1,#1               // et on pousse le bit de gauche dans la partie haute
3:
    orr x0,x0,x4               // position du dernier bit du quotient
    mov x4,#0                  // raz du bit
    cmp x5,x2
    blt 4f
    sub x5,x5,x2                // on enleve le diviseur du reste
    mov x4,#1                   // dernier bit à 1
4:
                               // et boucle
    subs x3,x3,#1
    bgt 1b    
    lsl x1,x1,#1               // on decale le quotient de 1
    tst x0,1<<63
    lsl x0,x0,#1              // puis on decale la partie basse 
    beq 5f
    orr x1,x1,#1
5:
    orr x0,x0,x4                  // position du dernier bit du quotient
    mov x3,x5
100:
    ldp x4,x5,[sp],16          // restaur des  2 registres
    ldp x6,lr,[sp],16          // restaur des  2 registres
    ret                        // retour adresse lr x30
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
Output:
Program start
The first 25 abundant odd numbers are:
Number : 945  sum : 975
Number : 1575  sum : 1649
Number : 2205  sum : 2241
Number : 2835  sum : 2973
Number : 3465  sum : 4023
Number : 4095  sum : 4641
Number : 4725  sum : 5195
Number : 5355  sum : 5877
Number : 5775  sum : 6129
Number : 5985  sum : 6495
Number : 6435  sum : 6669
Number : 6615  sum : 7065
Number : 6825  sum : 7063
Number : 7245  sum : 7731
Number : 7425  sum : 7455
Number : 7875  sum : 8349
Number : 8085  sum : 8331
Number : 8415  sum : 8433
Number : 8505  sum : 8967
Number : 8925  sum : 8931
Number : 9135  sum : 9585
Number : 9555  sum : 9597
Number : 9765  sum : 10203
Number : 10395  sum : 12645
Number : 11025  sum : 11946
The 1000 odd abundant number :
Number : 492975  sum : 519361
First odd abundant number > 1000000000 :
Number : 1000000575  sum : 1083561009
Program normal end.

Ada[edit]

This solution uses the package Generic_Divisors from the Proper Divisors task [[1]].

with Ada.Text_IO, Generic_Divisors;

procedure Odd_Abundant is
   function Same(P: Positive) return Positive is (P);
   
   package Divisor_Sum is new Generic_Divisors
     (Result_Type => Natural, None => 0, One => Same, Add =>  "+");
   
   function Abundant(N: Positive) return Boolean is
      (Divisor_Sum.Process(N) > N);
      
   package NIO is new Ada.Text_IO.Integer_IO(Natural);
   
   Current: Positive := 1;
   
   procedure Print_Abundant_Line
     (Idx: Positive; N: Positive; With_Idx: Boolean:= True) is
   begin
      if With_Idx then 
	 NIO.Put(Idx, 6);  Ada.Text_IO.Put(" |");
      else
	 Ada.Text_IO.Put("   *** |");
      end if;
      NIO.Put(N, 12); Ada.Text_IO.Put(" | "); 
      NIO.Put(Divisor_Sum.Process(N), 12); Ada.Text_IO.New_Line;
   end Print_Abundant_Line;      
   
begin
   -- the first 25 abundant odd numbers
   Ada.Text_IO.Put_Line(" index |      number | proper divisor sum ");
   Ada.Text_IO.Put_Line("-------+-------------+--------------------");
   for I in 1 .. 25 loop
      while not Abundant(Current) loop
	 Current := Current + 2;
      end loop;
      Print_Abundant_Line(I, Current);
      Current := Current + 2;
   end loop;
   
   -- the one thousandth abundant odd number
   Ada.Text_IO.Put_Line("-------+-------------+--------------------");
   for I in 26 .. 1_000 loop
      Current := Current + 2;
      while not Abundant(Current) loop
	 Current := Current + 2;
      end loop;
   end loop;
   Print_Abundant_Line(1000, Current);
   
   -- the first abundant odd number greater than 10**9
   Ada.Text_IO.Put_Line("-------+-------------+--------------------");
   Current := 10**9+1;
   while not Abundant(Current) loop
      Current := Current + 2;
   end loop;
   Print_Abundant_Line(1, Current, False);
end Odd_Abundant;
Output:
 Index |      Number | proper divisor sum 
-------+-------------+--------------------
     1 |         945 |          975
     2 |        1575 |         1649
     3 |        2205 |         2241
     4 |        2835 |         2973
     5 |        3465 |         4023
     6 |        4095 |         4641
     7 |        4725 |         5195
     8 |        5355 |         5877
     9 |        5775 |         6129
    10 |        5985 |         6495
    11 |        6435 |         6669
    12 |        6615 |         7065
    13 |        6825 |         7063
    14 |        7245 |         7731
    15 |        7425 |         7455
    16 |        7875 |         8349
    17 |        8085 |         8331
    18 |        8415 |         8433
    19 |        8505 |         8967
    20 |        8925 |         8931
    21 |        9135 |         9585
    22 |        9555 |         9597
    23 |        9765 |        10203
    24 |       10395 |        12645
    25 |       11025 |        11946
-------+-------------+--------------------
  1000 |      492975 |       519361
-------+-------------+--------------------
   *** |  1000000575 |   1083561009

ALGOL 68[edit]

BEGIN
    # find some abundant odd numbers - numbers where the sum of the proper    #
    #                                  divisors is bigger than the number     #
    #                                  itself                                 #

    # returns the sum of the proper divisors of n                             #
    PROC divisor sum = ( INT n )INT:
    BEGIN
        INT sum := 1;
        FOR d FROM 2 TO ENTIER sqrt( n ) DO
            IF n MOD d = 0 THEN
                sum +:= d;
                IF INT other d := n OVER d;
                   other d /= d
                THEN
                    sum +:= other d
                FI
            FI
        OD;
        sum
    END # divisor sum # ;
    # find numbers required by the task                                       #
    BEGIN
        # first 25 odd abundant numbers                                       #
        INT odd number := 1;
        INT a count    := 0;
        INT d sum      := 0;
        print( ( "The first 25 abundant odd numbers:", newline ) );
        WHILE a count < 25 DO
            IF ( d sum := divisor sum( odd number ) ) > odd number THEN
                a count +:= 1;
                print( ( whole( odd number, -6 )
                       , " proper divisor sum: "
                       , whole( d sum, 0 )
                       , newline
                       )
                     )
            FI;
            odd number +:= 2
        OD;
        # 1000th odd abundant number                                          #
        WHILE a count < 1 000 DO
            IF ( d sum := divisor sum( odd number ) ) > odd number THEN
                a count := a count + 1
            FI;
            odd number +:= 2
        OD;
        print( ( "1000th abundant odd number:"
               , newline
               , "    "
               , whole( odd number - 2, 0 )
               , " proper divisor sum: "
               , whole( d sum, 0 )
               , newline
               )
             );
        # first odd abundant number > one billion                             #
        odd number := 1 000 000 001;
        BOOL found := FALSE;
        WHILE NOT found DO
            IF ( d sum := divisor sum( odd number ) ) > odd number THEN
                found  := TRUE;
                print( ( "First abundant odd number > 1 000 000 000:"
                       , newline
                       , "    "
                       , whole( odd number, 0 )
                       , " proper divisor sum: "
                       , whole( d sum, 0 )
                       , newline
                       )
                     )
            FI;
            odd number +:= 2
        OD
    END
END
Output:
The first 25 abundant odd numbers:
   945 proper divisor sum: 975
  1575 proper divisor sum: 1649
  2205 proper divisor sum: 2241
  2835 proper divisor sum: 2973
  3465 proper divisor sum: 4023
  4095 proper divisor sum: 4641
  4725 proper divisor sum: 5195
  5355 proper divisor sum: 5877
  5775 proper divisor sum: 6129
  5985 proper divisor sum: 6495
  6435 proper divisor sum: 6669
  6615 proper divisor sum: 7065
  6825 proper divisor sum: 7063
  7245 proper divisor sum: 7731
  7425 proper divisor sum: 7455
  7875 proper divisor sum: 8349
  8085 proper divisor sum: 8331
  8415 proper divisor sum: 8433
  8505 proper divisor sum: 8967
  8925 proper divisor sum: 8931
  9135 proper divisor sum: 9585
  9555 proper divisor sum: 9597
  9765 proper divisor sum: 10203
 10395 proper divisor sum: 12645
 11025 proper divisor sum: 11946
1000th abundant odd number:
    492975 proper divisor sum: 519361
First abundant odd number > 1 000 000 000:
    1000000575 proper divisor sum: 1083561009

ALGOL W[edit]

Translation of: ALGOL 68

Using the divisor_sum procedure from the Sum_of_divisors#ALGOL_W task.

begin
    % find some abundant odd numbers - numbers where the sum of the proper    %
    %                                  divisors is bigger than the number     %
    %                                  itself                                 %

    % computes the sum of the divisors of v using the prime                   %
    % factorisation                                                           %
    integer procedure divisor_sum( integer value v ) ; begin
        integer total, power, n, p;
        total := 1; power := 2; n := v;
        % Deal with powers of 2 first %
        while not odd( n ) do begin
            total := total + power;
            power := power * 2;
            n     := n div 2
        end while_not_odd_n ;
        % Odd prime factors up to the square root %
        p := 3;
        while ( p * p ) <= n do begin
            integer sum;
            sum   := 1;
            power := p;
            while n rem p = 0 do begin
                sum   := sum + power;
                power := power * p;
                n     := n div p
            end while_n_rem_p_eq_0 ;
            p     := p + 2;
            total := total * sum
        end while_p_x_p_le_n ;
        % If n > 1 then it's prime %
        if n > 1 then total := total * ( n + 1 );
        total
    end divisor_sum ;
    % returns the sum of the proper divisors of v                             %
    integer procedure divisorSum( integer value v ) ;
        if v < 2 then 0 else divisor_sum( v ) - v;
    % find numbers required by the task                                       %
    begin
        integer aCount, oddNumber, dSum;
        logical foundOddAn;
        % first 25 odd abundant numbers                                       %
        oddNumber := 1;
        aCount    := 0;
        write( "The first 25 abundant odd numbers:" );
        while aCount < 25 do begin
            dSum := divisorSum( oddNumber );
            if dSum > oddNumber then begin
                aCount := aCount + 1;
                write( i_w := 6, oddNumber, " proper divisor sum: ", dSum )
            end if_dSum_gt_oddNumber ;
            oddNumber := oddNumber + 2
        end while_aCount_lt_1000 ;
        % 1000th odd abundant number                                          %
        while aCount < 1000 do begin
            dSum := divisorSum( oddNumber );
            if dSum > oddNumber then aCount := aCount + 1;
            oddNumber := oddNumber + 2
        end while_aCount_lt_1000 ;
        write( "1000th abundant odd number: " );
        write( oddNumber - 2, " proper divisor sum: ", dSum );
        % first odd abundant number > one billion                             %
        oddNumber  := 1000000001;
        foundOddAn := false;
        while not foundOddAn do begin
            dSum := divisorSum( oddNumber );
            if dSum > oddNumber then begin
                foundOddAn := true;
                write( "First abundant odd number > 1000000000: " );
                write( oddNumber, " proper divisor sum: ", dSum )
            end if_dSum_gt_oddNumber ;
            oddNumber := oddNumber + 2
        end while_not_foundOddAn ;
    end
end.
Output:
The first 25 abundant odd numbers:
   945   proper divisor sum:    975  
  1575   proper divisor sum:   1649  
  2205   proper divisor sum:   2241  
  2835   proper divisor sum:   2973  
  3465   proper divisor sum:   4023  
  4095   proper divisor sum:   4641  
  4725   proper divisor sum:   5195  
  5355   proper divisor sum:   5877  
  5775   proper divisor sum:   6129  
  5985   proper divisor sum:   6495  
  6435   proper divisor sum:   6669  
  6615   proper divisor sum:   7065  
  6825   proper divisor sum:   7063  
  7245   proper divisor sum:   7731  
  7425   proper divisor sum:   7455  
  7875   proper divisor sum:   8349  
  8085   proper divisor sum:   8331  
  8415   proper divisor sum:   8433  
  8505   proper divisor sum:   8967  
  8925   proper divisor sum:   8931  
  9135   proper divisor sum:   9585  
  9555   proper divisor sum:   9597  
  9765   proper divisor sum:  10203  
 10395   proper divisor sum:  12645  
 11025   proper divisor sum:  11946  
1000th abundant odd number: 
        492975   proper divisor sum:         519361  
First abundant odd number > 1000000000: 
    1000000575   proper divisor sum:     1083561009  

AppleScript[edit]

on aliquotSum(n)
    if (n < 2) then return 0
    set sum to 1
    set sqrt to n ^ 0.5
    set limit to sqrt div 1
    if (limit = sqrt) then
        set sum to sum + limit
        set limit to limit - 1
    end if
    repeat with i from 2 to limit
        if (n mod i is 0) then set sum to sum + i + n div i
    end repeat
    
    return sum
end aliquotSum

-- Task code:
local output, counter, n, sum, astid
set output to {"The first 25 abundant odd numbers:"}
set counter to 0
set n to 1
repeat until (counter = 25)
    set sum to aliquotSum(n)
    if (sum > n) then
        set end of output to "  " & n & "  (proper divisor sum:  " & sum & ")"
        set counter to counter + 1
    end if
    set n to n + 2
end repeat

set end of output to "The one thousandth:"
repeat until (counter = 1000)
    set sum to aliquotSum(n)
    if (sum > n) then set counter to counter + 1
    set n to n + 2
end repeat
set end of output to "  " & (n - 2) & "  (proper divisor sum:  " & sum & ")"

set end of output to "The first > 1,000,000,000:"
set n to 1.000000001E+9
set sum to aliquotSum(n)
repeat until (sum > n)
    set n to n + 2
    set sum to aliquotSum(n)
end repeat
set end of output to "  " & (n div 1000000) & text 2 thru -1 of ((1000000 + ((n mod 1000000) as integer)) as text) & ¬
    "  (proper divisor sum:  " & (sum div 1000000) & text 2 thru -1 of ((1000000 + ((sum mod 1000000) as integer)) as text) & ")"

set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to linefeed
set output to output as text
set AppleScript's text item delimiters to astid
return output
Output:
"The first 25 abundant odd numbers:
  945  (proper divisor sum:  975)
  1575  (proper divisor sum:  1649)
  2205  (proper divisor sum:  2241)
  2835  (proper divisor sum:  2973)
  3465  (proper divisor sum:  4023)
  4095  (proper divisor sum:  4641)
  4725  (proper divisor sum:  5195)
  5355  (proper divisor sum:  5877)
  5775  (proper divisor sum:  6129)
  5985  (proper divisor sum:  6495)
  6435  (proper divisor sum:  6669)
  6615  (proper divisor sum:  7065)
  6825  (proper divisor sum:  7063)
  7245  (proper divisor sum:  7731)
  7425  (proper divisor sum:  7455)
  7875  (proper divisor sum:  8349)
  8085  (proper divisor sum:  8331)
  8415  (proper divisor sum:  8433)
  8505  (proper divisor sum:  8967)
  8925  (proper divisor sum:  8931)
  9135  (proper divisor sum:  9585)
  9555  (proper divisor sum:  9597)
  9765  (proper divisor sum:  10203)
  10395  (proper divisor sum:  12645)
  11025  (proper divisor sum:  11946)
The one thousandth:
  492975  (proper divisor sum:  519361)
The first > 1,000,000,000:
  1000000575  (proper divisor sum:  1083561009)"

ARM Assembly[edit]

Works with: as version Raspberry Pi
/* ARM assembly Raspberry PI  */
/* program abundant.s   */

 /* REMARK 1 : this program use routines in a include file 
   see task Include a file language arm assembly 
   for the routine affichageMess conversion10 
   see at end of this program the instruction include */
/* for constantes see task include a file in arm assembly */
/************************************/
/* Constantes                       */
/************************************/
.include "../constantes.inc"

.equ NBDIVISORS,             1000

/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szMessStartPgm:          .asciz "Program start \n"
szMessEndPgm:            .asciz "Program normal end.\n"
szMessErrorArea:         .asciz "\033[31mError : area divisors too small.\n"
szMessError:             .asciz "\033[31mError  !!!\n"
szMessErrGen:            .asciz "Error end program.\n"
szMessNbPrem:            .asciz "This number is prime !!!.\n"
szMessResultFact:        .asciz "@ "

szCarriageReturn:        .asciz "\n"

/* datas message display */
szMessEntete:            .asciz "The first 25 abundant odd numbers are:\n"
szMessResult:            .asciz "Number : @  sum : @ \n"

szMessEntete1:           .asciz "The 1000 odd abundant number :\n"
szMessEntete2:           .asciz "First odd abundant number > 1000000000 :\n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss 
.align 4
sZoneConv:               .skip 24
tbZoneDecom:             .skip 4 * NBDIVISORS       // facteur 4 octets
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main 
main:                               @ program start
    ldr r0,iAdrszMessStartPgm       @ display start message
    bl affichageMess

    ldr r0,iAdrszMessEntete         @ display result message
    bl affichageMess
    mov r2,#1
    mov r3,#0
1:
    mov r0,r2                       @  number
    bl testAbundant
    cmp r0,#1
    bne 3f
    add r3,#1
    mov r0,r2
    mov r4,r1                        @ save sum
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    ldr r0,iAdrszMessResult
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc               @ and put in message
    mov r5,r0
    mov r0,r4                        @ sum 
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    mov r0,r5
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc               @ and put in message

    bl affichageMess
3:
    add r2,r2,#2
    cmp r3,#25
    blt 1b

    /* 1000 abundant number  */
    ldr r0,iAdrszMessEntete1
    bl affichageMess
    mov r2,#1
    mov r3,#0
4:
    mov r0,r2                       @  number
    bl testAbundant
    cmp r0,#1
    bne 6f
    add r3,#1
6:
    cmp r3,#1000
    addlt r2,r2,#2
    blt 4b
    mov r0,r2
    mov r4,r1                        @ save sum
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    ldr r0,iAdrszMessResult
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc               @ and put in message
    mov r5,r0
    mov r0,r4                        @ sum 
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    mov r0,r5
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc                @ and put in message

    bl affichageMess

    /* abundant number>1000000000   */
    ldr r0,iAdrszMessEntete2
    bl affichageMess
    ldr r2,iN10P9
    add r2,#1
    mov r3,#0
7:
    mov r0,r2                       @  number
    bl testAbundant
    cmp r0,#1
    beq 8f
    add r2,r2,#2
    b 7b
8:
    mov r0,r2
    mov r4,r1                        @ save sum
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    ldr r0,iAdrszMessResult
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc               @ and put in message
    mov r5,r0
    mov r0,r4                        @ sum 
    ldr r1,iAdrsZoneConv
    bl conversion10                  @ convert ascii string
    mov r0,r5
    ldr r1,iAdrsZoneConv
    bl strInsertAtCharInc                @ and put in message

    bl affichageMess



    ldr r0,iAdrszMessEndPgm         @ display end message
    bl affichageMess
    b 100f
99:                                 @ display error message 
    ldr r0,iAdrszMessError
    bl affichageMess
100:                                @ standard end of the program
    mov r0, #0                      @ return code
    mov r7, #EXIT                   @ request to exit program
    svc 0                           @ perform system call
iAdrszMessStartPgm:        .int szMessStartPgm
iAdrszMessEndPgm:          .int szMessEndPgm
iAdrszMessError:           .int szMessError
iAdrszCarriageReturn:      .int szCarriageReturn
iAdrtbZoneDecom:           .int tbZoneDecom
iAdrszMessEntete:          .int szMessEntete
iAdrszMessEntete1:         .int szMessEntete1
iAdrszMessEntete2:         .int szMessEntete2
iAdrszMessResult:          .int szMessResult
iAdrsZoneConv:             .int sZoneConv
iN10P9:                    .int 1000000000
/******************************************************************/
/*     test if number is abundant number                         */ 
/******************************************************************/
/* r0 contains the number  */
/* r0 return 1 if Zumkeller number else return 0  */
testAbundant:
    push {r2-r6,lr}              @ save  registers 
    mov r6,r0                    @ save number
    ldr r1,iAdrtbZoneDecom
    bl decompFact                @ create area of divisors
    cmp r0,#1                    @ no divisors
    movle r0,#0
    ble 100f
    lsl r5,r6,#1                 @ abondant number ?
    cmp r5,r2
    movgt r0,#0                  
    bgt 100f                     @ no -> end
    mov r0,#1
    sub r1,r2,r6                 @ sum
100:
    pop {r2-r6,lr}               @ restaur registers
    bx lr                        @ return



/******************************************************************/
/*     factor decomposition                                               */ 
/******************************************************************/
/* r0 contains number */
/* r1 contains address of divisors area */
/* r0 return divisors items in table */
/* r1 return the number of odd divisors  */
/* r2 return the sum of divisors  */
decompFact:
    push {r3-r8,lr}              @ save  registers
    mov r5,r1
    mov r8,r0                    @ save number
    bl isPrime                   @ prime ?
    cmp r0,#1
    beq 98f                      @ yes is prime
    mov r1,#1
    str r1,[r5]                  @ first factor
    mov r12,#1                   @ divisors sum
    mov r11,#1                   @ number odd divisors
    mov r4,#1                    @ indice divisors table
    mov r1,#2                    @ first divisor
    mov r6,#0                    @ previous divisor
    mov r7,#0                    @ number of same divisors
2:
    mov r0,r8                    @ dividende
    bl division                  @  r1 divisor r2 quotient r3 remainder
    cmp r3,#0
    bne 5f                       @ if remainder <> zero  -> no divisor
    mov r8,r2                    @ else quotient -> new dividende
    cmp r1,r6                    @ same divisor ?
    beq 4f                       @ yes
    mov r7,r4                    @ number factors in table
    mov r9,#0                    @ indice
21:
    ldr r10,[r5,r9,lsl #2 ]      @ load one factor
    mul r10,r1,r10               @ multiply 
    str r10,[r5,r7,lsl #2]       @ and store in the table
    tst r10,#1                   @ divisor odd ?
    addne r11,#1
    add r12,r10
    add r7,r7,#1                 @ and increment counter
    add r9,r9,#1
    cmp r9,r4  
    blt 21b
    mov r4,r7
    mov r6,r1                    @ new divisor
    b 7f
4:                               @ same divisor
    sub r9,r4,#1
    mov r7,r4
41:
    ldr r10,[r5,r9,lsl #2 ]
    cmp r10,r1
    subne r9,#1
    bne 41b
    sub r9,r4,r9
42:
    ldr  r10,[r5,r9,lsl #2 ]
    mul r10,r1,r10
    str r10,[r5,r7,lsl #2]       @ and store in the table
    tst r10,#1                   @ divsor odd ?
    addne r11,#1
    add r12,r10
    add r7,r7,#1                 @ and increment counter
    add r9,r9,#1
    cmp r9,r4  
    blt 42b
    mov r4,r7
    b 7f                         @ and loop
    
    /* not divisor -> increment next divisor */
5:
    cmp r1,#2                    @ if divisor = 2 -> add 1 
    addeq r1,#1
    addne r1,#2                  @ else add 2
    b 2b
    
    /* divisor -> test if new dividende is prime */
7: 
    mov r3,r1                    @ save divisor
    cmp r8,#1                    @ dividende = 1 ? -> end
    beq 10f
    mov r0,r8                    @ new dividende is prime ?
    mov r1,#0
    bl isPrime                   @ the new dividende is prime ?
    cmp r0,#1
    bne 10f                      @ the new dividende is not prime

    cmp r8,r6                    @ else dividende is same divisor ?
    beq 9f                       @ yes
    mov r7,r4                    @ number factors in table
    mov r9,#0                    @ indice
71:
    ldr r10,[r5,r9,lsl #2 ]      @ load one factor
    mul r10,r8,r10               @ multiply 
    str r10,[r5,r7,lsl #2]       @ and store in the table
    tst r10,#1                   @ divsor odd ?
    addne r11,#1
    add r12,r10
    add r7,r7,#1                 @ and increment counter
    add r9,r9,#1
    cmp r9,r4  
    blt 71b
    mov r4,r7
    mov r7,#0
    b 11f
9:
    sub r9,r4,#1
    mov r7,r4
91:
    ldr r10,[r5,r9,lsl #2 ]
    cmp r10,r8
    subne r9,#1
    bne 91b
    sub r9,r4,r9
92:
    ldr  r10,[r5,r9,lsl #2 ]
    mul r10,r8,r10
    str r10,[r5,r7,lsl #2]       @ and store in the table
    tst r10,#1                   @ divisor odd ?
    addne r11,#1
    add r12,r10
    add r7,r7,#1                 @ and increment counter
    add r9,r9,#1
    cmp r9,r4  
    blt 92b
    mov r4,r7
    b 11f
    
10:
    mov r1,r3                    @ current divisor = new divisor
    cmp r1,r8                    @ current divisor  > new dividende ?
    ble 2b                       @ no -> loop
    
    /* end decomposition */ 
11:
    mov r0,r4                    @ return number of table items
    mov r2,r12                   @ return sum 
    mov r1,r11                   @ return number of odd divisor 
    mov r3,#0
    str r3,[r5,r4,lsl #2]        @ store zéro in last table item
    b 100f

    
98: 
    //ldr r0,iAdrszMessNbPrem
    //bl   affichageMess
    mov r0,#1                   @ return code
    b 100f
99:
    ldr r0,iAdrszMessError
    bl   affichageMess
    mov r0,#-1                  @ error code
    b 100f
100:
    pop {r3-r8,lr}              @ restaur registers
    bx lr
iAdrszMessNbPrem:           .int szMessNbPrem
/***************************************************/
/*   check if a number is prime              */
/***************************************************/
/* r0 contains the number            */
/* r0 return 1 if prime  0 else */
@2147483647
@4294967297
@131071
isPrime:
    push {r1-r6,lr}    @ save registers 
    cmp r0,#0
    beq 90f
    cmp r0,#17
    bhi 1f
    cmp r0,#3
    bls 80f            @ for 1,2,3 return prime
    cmp r0,#5
    beq 80f            @ for 5 return prime
    cmp r0,#7
    beq 80f            @ for 7 return prime
    cmp r0,#11
    beq 80f            @ for 11 return prime
    cmp r0,#13
    beq 80f            @ for 13 return prime
    cmp r0,#17
    beq 80f            @ for 17 return prime
1:
    tst r0,#1          @ even ?
    beq 90f            @ yes -> not prime
    mov r2,r0          @ save number
    sub r1,r0,#1       @ exposant n - 1
    mov r0,#3          @ base
    bl moduloPuR32     @ compute base power n - 1 modulo n
    cmp r0,#1
    bne 90f            @ if <> 1  -> not prime
 
    mov r0,#5
    bl moduloPuR32
    cmp r0,#1
    bne 90f
    
    mov r0,#7
    bl moduloPuR32
    cmp r0,#1
    bne 90f
    
    mov r0,#11
    bl moduloPuR32
    cmp r0,#1
    bne 90f
    
    mov r0,#13
    bl moduloPuR32
    cmp r0,#1
    bne 90f
    
    mov r0,#17
    bl moduloPuR32
    cmp r0,#1
    bne 90f
80:
    mov r0,#1        @ is prime
    b 100f
90:
    mov r0,#0        @ no prime
100:                 @ fin standard de la fonction 
    pop {r1-r6,lr}   @ restaur des registres
    bx lr            @ retour de la fonction en utilisant lr 
/********************************************************/
/*   Calcul modulo de b puissance e modulo m  */
/*    Exemple 4 puissance 13 modulo 497 = 445         */
/*                                             */
/********************************************************/
/* r0  nombre  */
/* r1 exposant */
/* r2 modulo   */
/* r0 return result  */
moduloPuR32:
    push {r1-r7,lr}    @ save registers  
    cmp r0,#0          @ verif <> zero 
    beq 100f
    cmp r2,#0          @ verif <> zero 
    beq 100f           @ TODO: vérifier les cas d erreur
1:
    mov r4,r2          @ save modulo
    mov r5,r1          @ save exposant 
    mov r6,r0          @ save base
    mov r3,#1          @ start result

    mov r1,#0          @ division de r0,r1 par r2
    bl division32R
    mov r6,r2          @ base <- remainder
2:
    tst r5,#1          @  exposant even or odd
    beq 3f
    umull r0,r1,r6,r3
    mov r2,r4
    bl division32R
    mov r3,r2          @ result <- remainder
3:
    umull r0,r1,r6,r6
    mov r2,r4
    bl division32R
    mov r6,r2          @ base <- remainder

    lsr r5,#1          @ left shift 1 bit
    cmp r5,#0          @ end ?
    bne 2b
    mov r0,r3
100:                   @ fin standard de la fonction
    pop {r1-r7,lr}     @ restaur des registres
    bx lr              @ retour de la fonction en utilisant lr    

/***************************************************/
/*   division number 64 bits in 2 registers by number 32 bits */
/***************************************************/
/* r0 contains lower part dividende   */
/* r1 contains upper part dividende   */
/* r2 contains divisor   */
/* r0 return lower part quotient    */
/* r1 return upper part quotient    */
/* r2 return remainder               */
division32R:
    push {r3-r9,lr}    @ save registers
    mov r6,#0          @ init upper upper part remainder  !!
    mov r7,r1          @ init upper part remainder with upper part dividende
    mov r8,r0          @ init lower part remainder with lower part dividende
    mov r9,#0          @ upper part quotient 
    mov r4,#0          @ lower part quotient
    mov r5,#32         @ bits number
1:                     @ begin loop
    lsl r6,#1          @ shift upper upper part remainder
    lsls r7,#1         @ shift upper  part remainder
    orrcs r6,#1        
    lsls r8,#1         @ shift lower  part remainder
    orrcs r7,#1
    lsls r4,#1         @ shift lower part quotient
    lsl r9,#1          @ shift upper part quotient
    orrcs r9,#1
                       @ divisor sustract  upper  part remainder
    subs r7,r2
    sbcs  r6,#0        @ and substract carry
    bmi 2f             @ négative ?
    
                       @ positive or equal
    orr r4,#1          @ 1 -> right bit quotient
    b 3f
2:                     @ negative 
    orr r4,#0          @ 0 -> right bit quotient
    adds r7,r2         @ and restaur remainder
    adc  r6,#0 
3:
    subs r5,#1         @ decrement bit size 
    bgt 1b             @ end ?
    mov r0,r4          @ lower part quotient
    mov r1,r9          @ upper part quotient
    mov r2,r7          @ remainder
100:                   @ function end
    pop {r3-r9,lr}     @ restaur registers
    bx lr  

/***************************************************/
/*      ROUTINES INCLUDE                 */
/***************************************************/
.include "../affichage.inc"
Program start
The first 25 abundant odd numbers are:
Number : 945          sum : 975
Number : 1575         sum : 1649
Number : 2205         sum : 2241
Number : 2835         sum : 2973
Number : 3465         sum : 4023
Number : 4095         sum : 4641
Number : 4725         sum : 5195
Number : 5355         sum : 5877
Number : 5775         sum : 6129
Number : 5985         sum : 6495
Number : 6435         sum : 6669
Number : 6615         sum : 7065
Number : 6825         sum : 7063
Number : 7245         sum : 7731
Number : 7425         sum : 7455
Number : 7875         sum : 8349
Number : 8085         sum : 8331
Number : 8415         sum : 8433
Number : 8505         sum : 8967
Number : 8925         sum : 8931
Number : 9135         sum : 9585
Number : 9555         sum : 9597
Number : 9765         sum : 10203
Number : 10395        sum : 12645
Number : 11025        sum : 11946
The 1000 odd abundant number :
Number : 492975       sum : 519361
First odd abundant number > 1000000000 :
Number : 1000000575   sum : 1083561009
Program normal end.

Arturo[edit]

abundant?: function [n]-> (2*n) < sum factors n

print "the first 25 abundant odd numbers:"
[i, found]: @[new 1, new 0]
while [found<25][
    if abundant? i [
        inc 'found
        print [i "=> sum:" sum factors i]
    ]
    'i + 2
]

[i, found]: @[new 1, new 0]
while [found<1000][
    if abundant? i [
        inc 'found
    ]
    'i + 2
]
print ["the 1000th abundant odd number:" i-2 "=> sum:" sum factors i-2]

i: new 1 + 10^9
while ø [
    if abundant? i [
        print ["the first abundant odd number greater than one billion (10^9):" i "=> sum:" sum factors i]
        break
    ]
    'i + 2
]
Output:
the first 25 abundant odd numbers:
945 => sum: 1920 
1575 => sum: 3224 
2205 => sum: 4446 
2835 => sum: 5808 
3465 => sum: 7488 
4095 => sum: 8736 
4725 => sum: 9920 
5355 => sum: 11232 
5775 => sum: 11904 
5985 => sum: 12480 
6435 => sum: 13104 
6615 => sum: 13680 
6825 => sum: 13888 
7245 => sum: 14976 
7425 => sum: 14880 
7875 => sum: 16224 
8085 => sum: 16416 
8415 => sum: 16848 
8505 => sum: 17472 
8925 => sum: 17856 
9135 => sum: 18720 
9555 => sum: 19152 
9765 => sum: 19968 
10395 => sum: 23040 
11025 => sum: 22971 
the 1000th abundant odd number: 492975 => sum: 1012336 
the first abundant odd number greater than one billion (10^9): 1000000575 => sum: 2083561584

AutoHotkey[edit]

Abundant(num){
	sum := 0, str := ""
	for n, bool in proper_divisors(num)
		sum += n,  str .= (str?"+":"") n
	return sum > num ? str " = " sum : 0
}
proper_divisors(n) {
	Array := []
	if n = 1
		return Array
	Array[1] := true
	x := Floor(Sqrt(n))
	loop, % x+1
		if !Mod(n, i:=A_Index+1) && (floor(n/i) < n)
			Array[floor(n/i)] := true
	Loop % n/x
		if !Mod(n, i:=A_Index+1) && (i < n)
			Array[i] := true
	return Array
}
Examples:
output := "First 25 abundant odd numbers:`n"
while (count<1000)
{
	oddNum := 2*A_Index-1
	if (str := Abundant(oddNum))
	{
		count++
		if (count<=25)
			output .= oddNum " " str "`n"
		if (count = 1000)
			output .= "`nOne thousandth abundant odd number:`n" oddNum " " str "`n"
	}
}
count := 0
while !count
{
	num := 2*A_Index -1 + 1000000000
	if (str := Abundant(num))
	{
		count++
		output .= "`nFirst abundant odd number greater than one billion:`n" num " " str "`n"
	}
}
MsgBox % output
return
Output:
First 25 abundant odd numbers:
945 1+3+5+7+9+15+21+27+35+45+63+105+135+189+315 = 975
1575 1+3+5+7+9+15+21+25+35+45+63+75+105+175+225+315+525 = 1649
2205 1+3+5+7+9+15+21+35+45+49+63+105+147+245+315+441+735 = 2241
2835 1+3+5+7+9+15+21+27+35+45+63+81+105+135+189+315+405+567+945 = 2973
3465 1+3+5+7+9+11+15+21+33+35+45+55+63+77+99+105+165+231+315+385+495+693+1155 = 4023
4095 1+3+5+7+9+13+15+21+35+39+45+63+65+91+105+117+195+273+315+455+585+819+1365 = 4641
4725 1+3+5+7+9+15+21+25+27+35+45+63+75+105+135+175+189+225+315+525+675+945+1575 = 5195
5355 1+3+5+7+9+15+17+21+35+45+51+63+85+105+119+153+255+315+357+595+765+1071+1785 = 5877
5775 1+3+5+7+11+15+21+25+33+35+55+75+77+105+165+175+231+275+385+525+825+1155+1925 = 6129
5985 1+3+5+7+9+15+19+21+35+45+57+63+95+105+133+171+285+315+399+665+855+1197+1995 = 6495
6435 1+3+5+9+11+13+15+33+39+45+55+65+99+117+143+165+195+429+495+585+715+1287+2145 = 6669
6615 1+3+5+7+9+15+21+27+35+45+49+63+105+135+147+189+245+315+441+735+945+1323+2205 = 7065
6825 1+3+5+7+13+15+21+25+35+39+65+75+91+105+175+195+273+325+455+525+975+1365+2275 = 7063
7245 1+3+5+7+9+15+21+23+35+45+63+69+105+115+161+207+315+345+483+805+1035+1449+2415 = 7731
7425 1+3+5+9+11+15+25+27+33+45+55+75+99+135+165+225+275+297+495+675+825+1485+2475 = 7455
7875 1+3+5+7+9+15+21+25+35+45+63+75+105+125+175+225+315+375+525+875+1125+1575+2625 = 8349
8085 1+3+5+7+11+15+21+33+35+49+55+77+105+147+165+231+245+385+539+735+1155+1617+2695 = 8331
8415 1+3+5+9+11+15+17+33+45+51+55+85+99+153+165+187+255+495+561+765+935+1683+2805 = 8433
8505 1+3+5+7+9+15+21+27+35+45+63+81+105+135+189+243+315+405+567+945+1215+1701+2835 = 8967
8925 1+3+5+7+15+17+21+25+35+51+75+85+105+119+175+255+357+425+525+595+1275+1785+2975 = 8931
9135 1+3+5+7+9+15+21+29+35+45+63+87+105+145+203+261+315+435+609+1015+1305+1827+3045 = 9585
9555 1+3+5+7+13+15+21+35+39+49+65+91+105+147+195+245+273+455+637+735+1365+1911+3185 = 9597
9765 1+3+5+7+9+15+21+31+35+45+63+93+105+155+217+279+315+465+651+1085+1395+1953+3255 = 10203
10395 1+3+5+7+9+11+15+21+27+33+35+45+55+63+77+99+105+135+165+189+231+297+315+385+495+693+945+1155+1485+2079+3465 = 12645
11025 1+3+5+7+9+15+21+25+35+45+49+63+75+105+147+175+225+245+315+441+525+735+1225+1575+2205+3675 = 11946

One thousandth abundant odd number:
492975 1+3+5+7+9+15+21+25+35+45+63+75+105+175+225+313+315+525+939+1565+1575+2191+2817+4695
		+6573+7825+10955+14085+19719+23475+32865+54775+70425+98595+164325 = 519361

First abundant odd number greater than one billion:
1000000575 1+3+5+7+9+15+21+25+35+45+49+63+75+105+147+175+225+245+315+441+525+735+1225+1575
			+2205+3675+11025+90703+272109+453515+634921+816327+1360545+1904763+2267575+3174605
			+4081635+4444447+5714289+6802725+9523815+13333341+15873025+20408175+22222235+28571445
			+40000023+47619075+66666705+111111175+142857225+200000115+333333525 = 1083561009

AWK[edit]

# syntax: GAWK -f ABUNDANT_ODD_NUMBERS.AWK
# converted from C
BEGIN {
    print("   index     number        sum")
    fmt = "%8s %10d %10d\n"
    n = 1
    for (c=0; c<25; n+=2) {
      if (n < sum_proper_divisors(n)) {
        printf(fmt,++c,n,sum)
      }
    }
    for (; c<1000; n+=2) {
      if (n < sum_proper_divisors(n)) {
        c++
      }
    }
    printf(fmt,1000,n-2,sum)
    for (n=1000000001; ; n+=2) {
      if (n < sum_proper_divisors(n)) {
        break
      }
    }
    printf(fmt,"1st > 1B",n,sum)
    exit(0)
}
function sum_proper_divisors(n,  j) {
    sum = 1
    for (i=3; i<sqrt(n)+1; i+=2) {
      if (n % i == 0) {
        sum += i + (i == (j = n / i) ? 0 : j)
      }
    }
    return(sum)
}
Output:
   index     number        sum
       1        945        975
       2       1575       1649
       3       2205       2241
       4       2835       2973
       5       3465       4023
       6       4095       4641
       7       4725       5195
       8       5355       5877
       9       5775       6129
      10       5985       6495
      11       6435       6669
      12       6615       7065
      13       6825       7063
      14       7245       7731
      15       7425       7455
      16       7875       8349
      17       8085       8331
      18       8415       8433
      19       8505       8967
      20       8925       8931
      21       9135       9585
      22       9555       9597
      23       9765      10203
      24      10395      12645
      25      11025      11946
    1000     492975     519361
1st > 1B 1000000575 1083561009

BASIC256[edit]

Translation of: Visual Basic .NET
numimpar = 1
contar = 0
sumaDiv = 0

function SumaDivisores(n)
	# Devuelve la suma de los divisores propios de n
	suma = 1
	i = int(sqr(n))

	for d = 2 to i
		if n % d = 0 then
			suma += d
			otroD = n \ d
			if otroD <> d Then suma += otroD
		end if
	Next d
	Return suma
End Function

# Encontrar los números requeridos por la tarea:
# primeros 25 números abundantes impares
Print "Los primeros 25 números impares abundantes:"
While contar < 25
	sumaDiv = SumaDivisores(numimpar)
	If sumaDiv > numimpar Then
		contar += 1
		Print numimpar & " suma divisoria adecuada: " & sumaDiv
	End If
	numimpar += 2
End While

# 1000er número impar abundante
While contar < 1000
	sumaDiv = SumaDivisores(numimpar)
	If sumaDiv > numimpar Then contar += 1
	numimpar += 2
End While
Print Chr(10) & "1000º número impar abundante:"
Print "   " & (numimpar - 2) & " suma divisoria adecuada: " & sumaDiv

# primer número impar abundante > mil millones (millardo)
numimpar = 1000000001
encontrado = False
While Not encontrado
	sumaDiv = SumaDivisores(numimpar)
	If sumaDiv > numimpar Then
		encontrado = True
		Print Chr(10) & "Primer número impar abundante > 1 000 000 000:"
		Print "    " & numimpar & " suma divisoria adecuada: " & sumaDiv
	End If
	numimpar += 2
End While
End

C[edit]

#include <stdio.h>
#include <math.h>

// The following function is for odd numbers ONLY
// Please use "for (unsigned i = 2, j; i*i <= n; i ++)" for even and odd numbers
unsigned sum_proper_divisors(const unsigned n) {
  unsigned sum = 1;
  for (unsigned i = 3, j; i < sqrt(n)+1; i += 2) if (n % i == 0) sum += i + (i == (j = n / i) ? 0 : j);
  return sum;
}

int main(int argc, char const *argv[]) {
  unsigned n, c;
  for (n = 1, c = 0; c < 25; n += 2) if (n < sum_proper_divisors(n)) printf("%u: %u\n", ++c, n);

  for ( ; c < 1000; n += 2) if (n < sum_proper_divisors(n)) c ++;
  printf("\nThe one thousandth abundant odd number is: %u\n", n);

  for (n = 1000000001 ;; n += 2) if (n < sum_proper_divisors(n)) break;
  printf("The first abundant odd number above one billion is: %u\n", n);
  
  return 0;
}
Output:
1: 945
2: 1575
3: 2205
4: 2835
5: 3465
6: 4095
7: 4725
8: 5355
9: 5775
10: 5985
11: 6435
12: 6615
13: 6825
14: 7245
15: 7425
16: 7875
17: 8085
18: 8415
19: 8505
20: 8925
21: 9135
22: 9555
23: 9765
24: 10395
25: 11025

The one thousandth abundant odd number is: 492977
The first abundant odd number above one billion is: 1000000575

C#[edit]

using static System.Console;
using System.Collections.Generic;
using System.Linq;

public static class AbundantOddNumbers
{
    public static void Main() {
        WriteLine("First 25 abundant odd numbers:");
        foreach (var x in AbundantNumbers().Take(25)) WriteLine(x.Format());
        WriteLine();
        WriteLine($"The 1000th abundant odd number: {AbundantNumbers().ElementAt(999).Format()}");
        WriteLine();
        WriteLine($"First abundant odd number > 1b: {AbundantNumbers(1_000_000_001).First().Format()}");
    }

    static IEnumerable<(int n, int sum)> AbundantNumbers(int start = 3) =>
        start.UpBy(2).Select(n => (n, sum: n.DivisorSum())).Where(x => x.sum > x.n);

    static int DivisorSum(this int n) => 3.UpBy(2).TakeWhile(i => i * i <= n).Where(i => n % i == 0)
        .Select(i => (a:i, b:n/i)).Sum(p => p.a == p.b ? p.a : p.a + p.b) + 1;

    static IEnumerable<int> UpBy(this int n, int step) {
        for (int i = n; ; i+=step) yield return i;
    }

    static string Format(this (int n, int sum) pair) => $"{pair.n:N0} with sum {pair.sum:N0}";
}
Output:
First 25 abundant odd numbers:
945 with sum 975
1,575 with sum 1,649
2,205 with sum 2,241
2,835 with sum 2,973
3,465 with sum 4,023
4,095 with sum 4,641
4,725 with sum 5,195
5,355 with sum 5,877
5,775 with sum 6,129
5,985 with sum 6,495
6,435 with sum 6,669
6,615 with sum 7,065
6,825 with sum 7,063
7,245 with sum 7,731
7,425 with sum 7,455
7,875 with sum 8,349
8,085 with sum 8,331
8,415 with sum 8,433
8,505 with sum 8,967
8,925 with sum 8,931
9,135 with sum 9,585
9,555 with sum 9,597
9,765 with sum 10,203
10,395 with sum 12,645
11,025 with sum 11,946

The 1000th abundant odd number: 492,975 with sum 519,361

First abundant odd number > 1b: 1,000,000,575 with sum 1,083,561,009

C++[edit]

Translation of: Go
#include <algorithm>
#include <iostream>
#include <numeric>
#include <sstream>
#include <vector>

std::vector<int> divisors(int n) {
    std::vector<int> divs{ 1 };
    std::vector<int> divs2;

    for (int i = 2; i*i <= n; i++) {
        if (n%i == 0) {
            int j = n / i;
            divs.push_back(i);
            if (i != j) {
                divs2.push_back(j);
            }
        }
    }
    std::copy(divs2.crbegin(), divs2.crend(), std::back_inserter(divs));

    return divs;
}

int sum(const std::vector<int>& divs) {
    return std::accumulate(divs.cbegin(), divs.cend(), 0);
}

std::string sumStr(const std::vector<int>& divs) {
    auto it = divs.cbegin();
    auto end = divs.cend();
    std::stringstream ss;

    if (it != end) {
        ss << *it;
        it = std::next(it);
    }
    while (it != end) {
        ss << " + " << *it;
        it = std::next(it);
    }

    return ss.str();
}

int abundantOdd(int searchFrom, int countFrom, int countTo, bool printOne) {
    int count = countFrom;
    int n = searchFrom;
    for (; count < countTo; n += 2) {
        auto divs = divisors(n);
        int tot = sum(divs);
        if (tot > n) {
            count++;
            if (printOne && count < countTo) {
                continue;
            }
            auto s = sumStr(divs);
            if (printOne) {
                printf("%d < %s = %d\n", n, s.c_str(), tot);
            } else {
                printf("%2d. %5d < %s = %d\n", count, n, s.c_str(), tot);
            }
        }
    }
    return n;
}

int main() {
    using namespace std;

    const int max = 25;
    cout << "The first " << max << " abundant odd numbers are:\n";
    int n = abundantOdd(1, 0, 25, false);

    cout << "\nThe one thousandth abundant odd number is:\n";
    abundantOdd(n, 25, 1000, true);

    cout << "\nThe first abundant odd number above one billion is:\n";
    abundantOdd(1e9 + 1, 0, 1, true);

    return 0;
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

CLU[edit]

% Integer square root
isqrt = proc (s: int) returns (int)
    x0: int := s / 2
    if x0 = 0 then 
        return(s)
    else
        x1: int := (x0 + s/x0) / 2
        while x1 < x0 do
            x0 := x1
            x1 := (x0 + s/x0) / 2
        end
        return(x0)
    end
end isqrt 

% Calculate aliquot sum (for odd numbers only)
aliquot = proc (n: int) returns (int)
    sum: int := 1
    for i: int in int$from_to_by(3, isqrt(n)+1, 2) do
        if n//i = 0 then
            j: int := n / i
            sum := sum + i
            if i ~= j then
                sum := sum + j
            end
        end
    end
    return(sum)
end aliquot

% Generate abundant odd numbers
abundant_odd = iter (n: int) yields (int)
    while true do
        if n < aliquot(n) then yield(n) end
        n := n + 2
    end
end abundant_odd

start_up = proc ()
    po: stream := stream$primary_output()
    
    count: int := 0
    for n: int in abundant_odd(1) do
        count := count + 1
        if count <= 25 cor count = 1000 then
            stream$putl(po, int$unparse(count) 
                        || ":\t" 
                        || int$unparse(n)
                        || "\taliquot: "
                        || int$unparse(aliquot(n)))
            if count = 1000 then break end
        end
    end
    
    for n: int in abundant_odd(1000000001) do
        stream$putl(po, "First above 1 billion: " 
                        || int$unparse(n)
                        || " aliquot: "
                        || int$unparse(aliquot(n)))
        break
    end
end start_up
Output:
1:      945     aliquot: 975
2:      1575    aliquot: 1649
3:      2205    aliquot: 2241
4:      2835    aliquot: 2973
5:      3465    aliquot: 4023
6:      4095    aliquot: 4641
7:      4725    aliquot: 5195
8:      5355    aliquot: 5877
9:      5775    aliquot: 6129
10:     5985    aliquot: 6495
11:     6435    aliquot: 6669
12:     6615    aliquot: 7065
13:     6825    aliquot: 7063
14:     7245    aliquot: 7731
15:     7425    aliquot: 7455
16:     7875    aliquot: 8349
17:     8085    aliquot: 8331
18:     8415    aliquot: 8433
19:     8505    aliquot: 8967
20:     8925    aliquot: 8931
21:     9135    aliquot: 9585
22:     9555    aliquot: 9597
23:     9765    aliquot: 10203
24:     10395   aliquot: 12645
25:     11025   aliquot: 11946
1000:   492975  aliquot: 519361
First above 1 billion: 1000000575 aliquot: 1083561009

Common Lisp[edit]

Library: cl-annot
Library: iterate
Library: alexandria

Using the iterate library instead of the standard loop or do.

;; * Loading the external libraries
(eval-when (:compile-toplevel :load-toplevel)
  (ql:quickload '("cl-annot" "iterate" "alexandria")))

;; * The package definition
(defpackage :abundant-numbers
  (:use :common-lisp :cl-annot :iterate)
  (:import-from :alexandria :butlast))
(in-package :abundant-numbers)

(annot:enable-annot-syntax)

;; * Calculating the divisors 
@inline
(defun divisors (n)
  "Returns the divisors of N without sorting them."
  @type fixnum n
  (iter
    (for divisor from (isqrt n) downto 1)
    (for (values m rem) = (floor n divisor))
    @type fixnum divisor
    (when (zerop rem)
      (collecting divisor into result)
      (adjoining m into result))
    (finally (return result))))

;; * Calculating the sum of divisors
(defun sum-of-divisors (n)
  "Returns the sum of the proper divisors of N."
  @type fixnum n
  (reduce #'+ (butlast (divisors n))))

;; * Task 1
(time
 (progn
   (format t "   Task 1~%")
   (iter
     (with i = 0)
     (for n from 1 by 2)
     (for sum-of-divisors = (sum-of-divisors n))
     @type fixnum i n sum-of-divisors
     (while (< i 25))
     (when (< n sum-of-divisors)
       (incf i)
       (format t "~5D: ~6D ~7D~%" i n sum-of-divisors)))

   ;; * Task 2
   (format t "~%   Task 2~%")
   (iter
     (with i = 0)
     (until (= i 1000))
     (for n from 1 by 2)
     (for sum-of-divisors = (sum-of-divisors n))
     @type fixnum i n sum-of-divisors
     (when (< n sum-of-divisors)
       (incf i))
     (finally (format t "~5D: ~6D ~7D~%" i n sum-of-divisors)))

   ;; * Task 3
   (format t "~%   Task 3~%")
   (iter
     (for n from (1+ (expt 10 9)) by 2)
     (for sum-of-divisors = (sum-of-divisors n))
     @type fixnum n sum-of-divisors
     (until (< n sum-of-divisors))
     (finally (format t "~D ~D~%~%" n sum-of-divisors)))))
Output:
   Task 1
    1:    945     975
    2:   1575    1649
    3:   2205    2241
    4:   2835    2973
    5:   3465    4023
    6:   4095    4641
    7:   4725    5195
    8:   5355    5877
    9:   5775    6129
   10:   5985    6495
   11:   6435    6669
   12:   6615    7065
   13:   6825    7063
   14:   7245    7731
   15:   7425    7455
   16:   7875    8349
   17:   8085    8331
   18:   8415    8433
   19:   8505    8967
   20:   8925    8931
   21:   9135    9585
   22:   9555    9597
   23:   9765   10203
   24:  10395   12645
   25:  11025   11946

   Task 2
 1000: 492975  519361

   Task 3
1000000575 1083561009

Evaluation took:
  1.022 seconds of real time
  1.023269 seconds of total run time (1.021605 user, 0.001664 system)
  [ Run times consist of 0.004 seconds GC time, and 1.020 seconds non-GC time. ]
  100.10% CPU
  1,422,837,844 processor cycles
  54,820,848 bytes consed

D[edit]

Translation of: C++
import std.stdio;

int[] divisors(int n) {
    import std.range;

    int[] divs = [1];
    int[] divs2;

    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            int j = n / i;
            divs ~= i;
            if (i != j) {
                divs2 ~= j;
            }
        }
    }
    divs ~= retro(divs2).array;

    return divs;
}

int abundantOdd(int searchFrom, int countFrom, int countTo, bool printOne) {
    import std.algorithm.iteration;
    import std.array;
    import std.conv;

    int count = countFrom;
    int n = searchFrom;
    for (; count < countTo; n += 2) {
        auto divs = divisors(n);
        int tot = sum(divs);
        if (tot > n) {
            count++;
            if (printOne && count < countTo) {
                continue;
            }
            auto s = divs.map!(to!string).join(" + ");
            if (printOne) {
                writefln("%d < %s = %d", n, s, tot);
            } else {
                writefln("%2d. %5d < %s = %d", count, n, s, tot);
            }
        }
    }
    return n;
}

void main() {
    const int max = 25;
    writefln("The first %d abundant odd numbers are:", max);
    int n = abundantOdd(1, 0, 25, false);

    writeln("\nThe one thousandth abundant odd number is:");
    abundantOdd(n, 25, 1000, true);

    writeln("\nThe first abundant odd number above one billion is:");
    abundantOdd(cast(int)(1e9 + 1), 0, 1, true);
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Delphi[edit]

Translation of: C
program AbundantOddNumbers;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function SumProperDivisors(const N: Cardinal): Cardinal;
var
  I, J: Cardinal;
begin
  Result := 1;
  I := 3;
  while I < Sqrt(N)+1 do begin
    if N mod I = 0 then begin
      J := N div I;
      Inc(Result, I);
      if I <> J then Inc(Result, J);
    end;
    Inc(I, 2);
  end;
end;

var
  C, N: Cardinal;
begin
  N := 1;
  C := 0;
  while C < 25 do begin
    Inc(N, 2);
    if N < SumProperDivisors(N) then begin
      Inc(C);
      WriteLn(Format('%u: %u', [C, N]));
    end;
  end;

  while C < 1000 do begin
    Inc(N, 2);
    if N < SumProperDivisors(N) then Inc(C);
  end;
  WriteLn(Format('The one thousandth abundant odd number is: %u', [N]));

  N := 1000000001;
  while N >= SumProperDivisors(N) do Inc(N, 2);
  WriteLn(Format('The first abundant odd number above one billion is: %u', [N]));

end.
Output:
1: 945
2: 1575
3: 2205
4: 2835
5: 3465
6: 4095
7: 4725
8: 5355
9: 5775
10: 5985
11: 6435
12: 6615
13: 6825
14: 7245
15: 7425
16: 7875
17: 8085
18: 8415
19: 8505
20: 8925
21: 9135
22: 9555
23: 9765
24: 10395
25: 11025
The one thousandth abundant odd number is: 492975
The first abundant odd number above one billion is: 1000000575

F#[edit]

// Abundant odd numbers. Nigel Galloway: August 1st., 2021
let fN g=Seq.initInfinite(int64>>(+)1L)|>Seq.takeWhile(fun n->n*n<=g)|>Seq.filter(fun n->g%n=0L)|>Seq.sumBy(fun n->let i=g/n in n+(if i=n then 0L else i))
let aon n=Seq.initInfinite(int64>>(*)2L>>(+)n)|>Seq.map(fun g->(g,fN g))|>Seq.filter(fun(n,g)->2L*n<g)
aon 1L|>Seq.take 25|>Seq.iter(fun(n,g)->printfn "The sum of the divisors of %d is %d" n g)
let n,g=aon 1L|>Seq.item 999 in printfn "\nThe 1000th abundant odd number is %d. The sum of it's divisors is %d" n g
let n,g=aon 1000000001L|>Seq.head in printfn "\nThe first abundant odd number greater than 1000000000 is %d. The sum of it's divisors is %d" n g
Output:
The sum of the divisors of 945 is 1920
The sum of the divisors of 1575 is 3224
The sum of the divisors of 2205 is 4446
The sum of the divisors of 2835 is 5808
The sum of the divisors of 3465 is 7488
The sum of the divisors of 4095 is 8736
The sum of the divisors of 4725 is 9920
The sum of the divisors of 5355 is 11232
The sum of the divisors of 5775 is 11904
The sum of the divisors of 5985 is 12480
The sum of the divisors of 6435 is 13104
The sum of the divisors of 6615 is 13680
The sum of the divisors of 6825 is 13888
The sum of the divisors of 7245 is 14976
The sum of the divisors of 7425 is 14880
The sum of the divisors of 7875 is 16224
The sum of the divisors of 8085 is 16416
The sum of the divisors of 8415 is 16848
The sum of the divisors of 8505 is 17472
The sum of the divisors of 8925 is 17856
The sum of the divisors of 9135 is 18720
The sum of the divisors of 9555 is 19152
The sum of the divisors of 9765 is 19968
The sum of the divisors of 10395 is 23040
The sum of the divisors of 11025 is 22971

The 1000th abundant odd number is 492975. The sum of it's divisors is 1012336

The first abundant odd number greater than 1000000000 is 1000000575. The sum of it's divisors is 2083561584

Factor[edit]

USING: arrays formatting io kernel lists lists.lazy math
math.primes.factors sequences tools.memory.private ;
IN: rosetta-code.abundant-odd-numbers

: σ ( n -- sum ) divisors sum ;
: abundant? ( n -- ? ) [ σ ] [ 2 * ] bi > ;
: abundant-odds-from ( n -- list )
    dup even? [ 1 + ] when
    [ 2 + ] lfrom-by [ abundant? ] lfilter ;

: first25 ( -- seq ) 25 1 abundant-odds-from ltake list>array ;
: 1,000th ( -- n ) 999 1 abundant-odds-from lnth ;
: first>10^9 ( -- n ) 1,000,000,001 abundant-odds-from car ;

GENERIC: show ( obj -- )
M: integer show dup σ [ commas ] bi@ "%-6s σ = %s\n" printf ;
M: array show [ show ] each ;

: abundant-odd-numbers-demo ( -- )
    first25 "First 25 abundant odd numbers:"
    1,000th "1,000th abundant odd number:"
    first>10^9 "First abundant odd number > one billion:"
    [ print show nl ] 2tri@ ;

MAIN: abundant-odd-numbers-demo
Output:
First 25 abundant odd numbers:
945    σ = 1,920
1,575  σ = 3,224
2,205  σ = 4,446
2,835  σ = 5,808
3,465  σ = 7,488
4,095  σ = 8,736
4,725  σ = 9,920
5,355  σ = 11,232
5,775  σ = 11,904
5,985  σ = 12,480
6,435  σ = 13,104
6,615  σ = 13,680
6,825  σ = 13,888
7,245  σ = 14,976
7,425  σ = 14,880
7,875  σ = 16,224
8,085  σ = 16,416
8,415  σ = 16,848
8,505  σ = 17,472
8,925  σ = 17,856
9,135  σ = 18,720
9,555  σ = 19,152
9,765  σ = 19,968
10,395 σ = 23,040
11,025 σ = 22,971

1,000th abundant odd number:
492,975 σ = 1,012,336

First abundant odd number > one billion:
1,000,000,575 σ = 2,083,561,584

Fortran[edit]

A basic direct solution. A more robust alternative would be to find the prime factors and then use a formulaic approach.

program main
use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
implicit none
integer,parameter          :: dp=kind(0.0d0)
character(len=*),parameter :: g='(*(g0,1x))'
integer                    :: j, icount
integer,allocatable        :: list(:)
real(kind=dp)              :: tally

   write(*,*)'N sum'
   icount=0                       ! number of abundant odd numbers found
   do j=1,huge(0)-1,2             ! loop through odd numbers for candidates
      list=divisors(j)            ! git list of divisors for current value
      tally= sum([real(list,kind=dp)]) ! sum divisors
      if(tally>2*j .and. iand(j,1) /= 0) then ! count an abundant odd number
         icount=icount+1
         select case(icount)  ! if one of the values targeted print it
         case(1:25,1000);write(*,g)icount,':',j!, list
         end select
      endif
      if(icount.gt.1000)exit ! quit after last targeted value is found
   enddo

   do j=1000000001,huge(0),2
      list=divisors(j)
      tally= sum([real(list,kind=dp)])
      if(tally>2*j .and. iand(j,1) /= 0) then
         write(*,g)'First abundant odd number greater than one billion:',j

         exit
      endif
   enddo

contains

function divisors(num) result (numbers)
!> brute force divisors
integer,intent(in) :: num
integer :: i
integer,allocatable :: numbers(:)
   numbers=[integer :: ]
   do i=1 , int(sqrt(real(num)))
      if (mod(num , i)  .eq. 0) numbers=[numbers, i,num/i]
   enddo
end function divisors

end program main
Output:
 N sum
1 : 945
2 : 1575
3 : 2205
4 : 2835
5 : 3465
6 : 4095
7 : 4725
8 : 5355
9 : 5775
10 : 5985
11 : 6435
12 : 6615
13 : 6825
14 : 7245
15 : 7425
16 : 7875
17 : 8085
18 : 8415
19 : 8505
20 : 8925
21 : 9135
22 : 9555
23 : 9765
24 : 10395
25 : 11025
1000 : 492975
First abundant odd number greater than one billion: 1000000575

FreeBASIC[edit]

Translation of: Visual Basic .NET
Declare Function SumaDivisores(n As Integer) As Integer

Dim numimpar As Integer = 1
Dim contar As Integer = 0
Dim sumaDiv As Integer = 0

Function SumaDivisores(n As Integer) As Integer
    ' Devuelve la suma de los divisores propios de n
    Dim suma As Integer = 1
    Dim As Integer d, otroD
    
    For d = 2 To Cint(Sqr(n))
        If n Mod d = 0 Then
            suma += d
            otroD = n \ d
            If otroD <> d Then suma += otroD
        End If
    Next d
    Return suma
End Function

' Encontrar los números requeridos por la tarea:

' primeros 25 números abundantes impares
Print "Los primeros 25 números impares abundantes:"
Do While contar < 25
    sumaDiv = SumaDivisores(numimpar)
    If sumaDiv > numimpar Then
        contar += 1
        Print using "######"; numimpar;
        Print " suma divisoria adecuada: " & sumaDiv
    End If
    numimpar += 2
Loop

' 1000er número impar abundante
Do While contar < 1000
    sumaDiv = SumaDivisores(numimpar)
    If sumaDiv > numimpar Then contar += 1
    numimpar += 2
Loop
Print Chr(10) & "1000º número impar abundante:"
Print "    " & (numimpar - 2) & " suma divisoria adecuada: " & sumaDiv

' primer número impar abundante > mil millones (millardo)
numimpar = 1000000001
Dim encontrado As Boolean = False
Do While Not encontrado
    sumaDiv = SumaDivisores(numimpar)
    If sumaDiv > numimpar Then
        encontrado = True
        Print Chr(10) & "Primer número impar abundante > 1 000 000 000:"
        Print "    " & numimpar & " suma divisoria adecuada: " & sumaDiv
    End If
    numimpar += 2
Loop
End
Output:
Los primeros 25 números impares abundantes:
   945 suma divisoria adecuada: 975
  1575 suma divisoria adecuada: 1649
  2205 suma divisoria adecuada: 2241
  2835 suma divisoria adecuada: 2973
  3465 suma divisoria adecuada: 4023
  4095 suma divisoria adecuada: 4641
  4725 suma divisoria adecuada: 5195
  5355 suma divisoria adecuada: 5877
  5775 suma divisoria adecuada: 6129
  5985 suma divisoria adecuada: 6495
  6435 suma divisoria adecuada: 6669
  6615 suma divisoria adecuada: 7065
  6825 suma divisoria adecuada: 7063
  7245 suma divisoria adecuada: 7731
  7425 suma divisoria adecuada: 7455
  7875 suma divisoria adecuada: 8349
  8085 suma divisoria adecuada: 8331
  8415 suma divisoria adecuada: 8433
  8505 suma divisoria adecuada: 8967
  8925 suma divisoria adecuada: 8931
  9135 suma divisoria adecuada: 9585
  9555 suma divisoria adecuada: 9597
  9765 suma divisoria adecuada: 10203
 10395 suma divisoria adecuada: 12645
 11025 suma divisoria adecuada: 11946

1000º número impar abundante:
    492975 suma divisoria adecuada: 519361

Primer número impar abundante > 1 000 000 000:
    1000000575 suma divisoria adecuada: 1083561009

Frink[edit]

Frink has efficient functions for factoring numbers that use trial division, wheel factoring, and Pollard rho factoring.

isAbundantOdd[n] := sum[allFactors[n, true, false]] > n

n = 3
count = 0

println["The first 25 abundant odd numbers:"]
do
{
   if isAbundantOdd[n]
   {
      println["$n: proper divisor sum " + sum[allFactors[n, 1, false]]]
      count = count + 1
   }

   n = n + 2
} while count < 25


println["\nThe thousandth abundant odd number:"]
n = 1
count = 0
do
{
   n = n + 2

   if isAbundantOdd[n]
      count = count + 1

} until count == 1000

println["$n: proper divisor sum " + sum[allFactors[n, 1, false]]]
   

println["\nThe first abundant odd number over 1 billion:"]
n = 10^9 + 1
count = 0
do
   n = n + 2
until isAbundantOdd[n]

println["$n: proper divisor sum " + sum[allFactors[n, 1, false]]]
Output:
The first 25 abundant odd numbers:
945: proper divisor sum 975
1575: proper divisor sum 1649
2205: proper divisor sum 2241
2835: proper divisor sum 2973
3465: proper divisor sum 4023
4095: proper divisor sum 4641
4725: proper divisor sum 5195
5355: proper divisor sum 5877
5775: proper divisor sum 6129
5985: proper divisor sum 6495
6435: proper divisor sum 6669
6615: proper divisor sum 7065
6825: proper divisor sum 7063
7245: proper divisor sum 7731
7425: proper divisor sum 7455
7875: proper divisor sum 8349
8085: proper divisor sum 8331
8415: proper divisor sum 8433
8505: proper divisor sum 8967
8925: proper divisor sum 8931
9135: proper divisor sum 9585
9555: proper divisor sum 9597
9765: proper divisor sum 10203
10395: proper divisor sum 12645
11025: proper divisor sum 11946

The thousandth abundant odd number:
492975: proper divisor sum 519361

The first abundant odd number over 1 billion:
1000000575: proper divisor sum 1083561009

FutureBasic[edit]

Translation of: C

FB's 'cln' keyword is used to enter a line of C or Objective-C code.

include "NSLog.incl"

local fn SumOfProperDivisors( n as NSUInteger ) as NSUinteger
  NSUinteger sum = 1

  cln for (unsigned i = 3, j; i < sqrt(n)+1; i += 2) if (n % i == 0) sum += i + (i == (j = n / i) ? 0 : j);
end fn = sum

NSUinteger n, c
cln for (n = 1, c = 0; c < 25; n += 2 ) if ( n < SumOfProperDivisors( n ) ) NSLog( @"%2lu: %lu", ++c, n );

cln for ( ; c < 1000; n += 2 ) if ( n < SumOfProperDivisors( n ) ) c ++;
NSLog( @"\nThe one thousandth abundant odd number is: %lu\n", n )

cln for ( n = 1000000001 ;; n += 2 ) if ( n < SumOfProperDivisors( n ) ) break;
NSLog( @"The first abundant odd number above one billion is: %lu\n", n )

HandleEvents

The following is a 'pure' FB code version.

include "NSLog.incl"

local fn SumOfProperDivisors( n as NSUInteger ) as NSUinteger
  NSUinteger i, j, sum = 1
  
  for i = 3 to sqr(n) step 2
    if ( n mod i == 0 )
      sum += i
      j = n/i
      if ( i != j )
        sum += j
      end if
    end if
  next
end fn = sum

NSUinteger n = 1, c

while ( c < 25 )
  if ( n < fn SumOfProperDivisors( n ) )
    NSLog( @"%2lu: %lu", c, n )
    c++
  end if
  n += 2
wend

while ( c < 1000 )
  if ( n < fn SumOfProperDivisors( n ) ) then c++
  n += 2
wend
NSLog( @"\nThe one thousandth abundant odd number is: %lu\n", n )

n = 1000000001
while ( n >= fn SumOfProperDivisors( n ) )
  n += 2
wend
NSLog( @"The first abundant odd number above one billion is: %lu\n", n )

HandleEvents
Output:
 1: 945
 2: 1575
 3: 2205
 4: 2835
 5: 3465
 6: 4095
 7: 4725
 8: 5355
 9: 5775
10: 5985
11: 6435
12: 6615
13: 6825
14: 7245
15: 7425
16: 7875
17: 8085
18: 8415
19: 8505
20: 8925
21: 9135
22: 9555
23: 9765
24: 10395
25: 11025

The one thousandth abundant odd number is: 492977

The first abundant odd number above one billion is: 1000000575

Go[edit]

package main

import (
    "fmt"
    "strconv"
)

func divisors(n int) []int {
    divs := []int{1}
    divs2 := []int{}
    for i := 2; i*i <= n; i++ {
        if n%i == 0 {
            j := n / i
            divs = append(divs, i)
            if i != j {
                divs2 = append(divs2, j)
            }
        }
    }
    for i := len(divs2) - 1; i >= 0; i-- {
        divs = append(divs, divs2[i])
    }
    return divs
}

func sum(divs []int) int {
    tot := 0
    for _, div := range divs {
        tot += div
    }
    return tot
}

func sumStr(divs []int) string {
    s := ""
    for _, div := range divs {
        s += strconv.Itoa(div) + " + "
    }
    return s[0 : len(s)-3]
}

func abundantOdd(searchFrom, countFrom, countTo int, printOne bool) int {
    count := countFrom
    n := searchFrom
    for ; count < countTo; n += 2 {
        divs := divisors(n)
        if tot := sum(divs); tot > n {
            count++
            if printOne && count < countTo {
                continue
            } 
            s := sumStr(divs)
            if !printOne {
                fmt.Printf("%2d. %5d < %s = %d\n", count, n, s, tot)
            } else {
                fmt.Printf("%d < %s = %d\n", n, s, tot)
            }
        }
    }
    return n
}

func main() {
    const max = 25
    fmt.Println("The first", max, "abundant odd numbers are:")
    n := abundantOdd(1, 0, 25, false)

    fmt.Println("\nThe one thousandth abundant odd number is:")
    abundantOdd(n, 25, 1000, true)

    fmt.Println("\nThe first abundant odd number above one billion is:")
    abundantOdd(1e9+1, 0, 1, true)
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Groovy[edit]

Translation of: Java
class Abundant {
    static List<Integer> divisors(int n) {
        List<Integer> divs = new ArrayList<>()
        divs.add(1)
        List<Integer> divs2 = new ArrayList<>()

        int i = 2
        while (i * i < n) {
            if (n % i == 0) {
                int j = (int) (n / i)
                divs.add(i)
                if (i != j) {
                    divs2.add(j)
                }
            }
            i++
        }

        Collections.reverse(divs2)
        divs.addAll(divs2)
        return divs
    }

    static int abundantOdd(int searchFrom, int countFrom, int countTo, boolean printOne) {
        int count = countFrom
        int n = searchFrom

        while (count < countTo) {
            List<Integer> divs = divisors(n)
            int tot = divs.stream().reduce(Integer.&sum).orElse(0)

            if (tot > n) {
                count++
                if (!printOne || count >= countTo) {
                    String s = divs.stream()
                            .map(Integer.&toString)
                            .reduce { a, b -> a + " + " + b }
                            .orElse("")
                    if (printOne) {
                        System.out.printf("%d < %s = %d\n", n, s, tot)
                    } else {
                        System.out.printf("%2d. %5d < %s = %d\n", count, n, s, tot)
                    }
                }
            }

            n += 2
        }

        return n
    }

    static void main(String[] args) {
        int max = 25

        System.out.printf("The first %d abundant odd numbers are:\n", max)
        int n = abundantOdd(1, 0, 25, false)

        System.out.println("\nThe one thousandth abundant odd number is:")
        abundantOdd(n, 25, 1000, true)

        System.out.println("\nThe first abundant odd number above one billion is:")
        abundantOdd((int) (1e9 + 1), 0, 1, true)
    }
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11841

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Haskell[edit]

import Data.List (nub)

divisorSum :: Integral a => a -> a
divisorSum n =
  sum
    . map (\i -> sum $ nub [i, n `quot` i])
    . filter ((== 0) . (n `rem`))
    $ takeWhile ((<= n) . (^ 2)) [1 ..]

oddAbundants :: Integral a => a -> [(a, a)]
oddAbundants n =
  [ (i, divisorSum i) | i <- [n ..], odd i, divisorSum i > i * 2 ]

printAbundant :: (Int, Int) -> IO ()
printAbundant (n, s) =
  putStrLn
    $  show n
    ++ " with "
    ++ show s
    ++ " as the sum of all proper divisors."

main :: IO ()
main = do
  putStrLn "The first 25 odd abundant numbers are:"
  mapM_ printAbundant . take 25 $ oddAbundants 1
  putStrLn "The 1000th odd abundant number is:"
  printAbundant $ oddAbundants 1 !! 1000
  putStrLn "The first odd abundant number above 1000000000 is:"
  printAbundant . head . oddAbundants $ 10 ^ 9
Output:
The first 25 odd abundant numbers are:
945 with 1920 as the sum of all proper divisors.
1575 with 3224 as the sum of all proper divisors.
2205 with 4446 as the sum of all proper divisors.
2835 with 5808 as the sum of all proper divisors.
3465 with 7488 as the sum of all proper divisors.
4095 with 8736 as the sum of all proper divisors.
4725 with 9920 as the sum of all proper divisors.
5355 with 11232 as the sum of all proper divisors.
5775 with 11904 as the sum of all proper divisors.
5985 with 12480 as the sum of all proper divisors.
6435 with 13104 as the sum of all proper divisors.
6615 with 13680 as the sum of all proper divisors.
6825 with 13888 as the sum of all proper divisors.
7245 with 14976 as the sum of all proper divisors.
7425 with 14880 as the sum of all proper divisors.
7875 with 16224 as the sum of all proper divisors.
8085 with 16416 as the sum of all proper divisors.
8415 with 16848 as the sum of all proper divisors.
8505 with 17472 as the sum of all proper divisors.
8925 with 17856 as the sum of all proper divisors.
9135 with 18720 as the sum of all proper divisors.
9555 with 19152 as the sum of all proper divisors.
9765 with 19968 as the sum of all proper divisors.
10395 with 23040 as the sum of all proper divisors.
11025 with 22971 as the sum of all proper divisors.
The 1000th odd abundant number is:
493185 with 1017792 as the sum of all proper divisors.
The first odd abundant number above 1000000000 is:
1000000575 with 2083561584 as the sum of all proper divisors.

Or, importing Data.Numbers.Primes (and significantly faster):

import Data.List (group, sort)
import Data.Numbers.Primes

abundantTuple :: Int -> [(Int, Int)]
abundantTuple n =
  let x = divisorSum n
   in [(n, x) | n < x]

divisorSum :: Int -> Int
divisorSum = sum . init . divisors

divisors :: Int -> [Int]
divisors =
  foldr
    (flip ((<*>) . fmap (*)) . scanl (*) 1)
    [1]
    . group
    . primeFactors

main :: IO ()
main = do
  putStrLn
    "First 25 abundant odd numbers with their divisor sums:"
  mapM_ print $ take 25 ([1, 3 ..] >>= abundantTuple)
  --
  putStrLn
    "\n1000th odd abundant number with its divisor sum:"
  print $ ([1, 3 ..] >>= abundantTuple) !! 999
  --
  putStrLn
    ( "\nFirst odd abundant number over 10^9, "
        <> "with its divisor sum:"
    )
  let billion = 10 ^ 9 :: Int
  print $
    head
      ( [1 + billion, 3 + billion ..]
          >>= abundantTuple
      )
Output:
First 25 abundant odd numbers with their divisor sums:
(945,975)
(1575,1649)
(2205,2241)
(2835,2973)
(3465,4023)
(4095,4641)
(4725,5195)
(5355,5877)
(5775,6129)
(5985,6495)
(6435,6669)
(6615,7065)
(6825,7063)
(7245,7731)
(7425,7455)
(7875,8349)
(8085,8331)
(8415,8433)
(8505,8967)
(8925,8931)
(9135,9585)
(9555,9597)
(9765,10203)
(10395,12645)
(11025,11946)

1000th odd abundant number with its divisor sum:
(492975,519361)

First odd abundant number over 10^9, with its divisor sum:
(1000000575,1083561009)

J[edit]

   NB. https://www.math.upenn.edu/~deturck/m170/wk3/lecture/sumdiv.html
   s=: ([: */ [: ((<:@:(^ >:)/) % <:@:{.) __&q:)&>

   assert 6045 -: s 1800

   aliquot_sum=: -~ s

   abundant=: < aliquot_sum

   Filter=: (#~`)(`:6)

   A=: abundant Filter 1 2 p. i. 260000  NB. a batch of abundant odd numbers

   # A   NB. more than 1000, it's enough.
1054

   NB. the first odd abundant numbers
   (,: aliquot_sum) 26 {. A
945 1575 2205 2835 3465 4095 4725 5355 5775 5985 6435 6615 6825 7245 7425 7875 8085 8415 8505 8925 9135 9555  9765 10395 11025 11655
975 1649 2241 2973 4023 4641 5195 5877 6129 6495 6669 7065 7063 7731 7455 8349 8331 8433 8967 8931 9585 9597 10203 12645 11946 12057

   NB. the one thousandth abundant odd number
   (,: aliquot_sum) 999 { A
492975
519361


   k=: adverb def '1000 * m'
   1x k k k
1000000000

   abundant Filter (1x k k k) + 1 2x p. i. 10x k
1000000575 1000001475 1000001625 1000001835 1000002465 1000003095 1000003725 1000004355 1000004775 1000004985 1000005435 1000005615 1000005825 1000006245 1000006425 1000006875 1000007505 1000008765 1000009395 1000010025 1000010655 1000011285 1000011705 100...

   (,: aliquot_sum) {. abundant Filter (1x k k k) + 1 2x p. i. 10x k
1000000575
1083561009

Java[edit]

import java.util.ArrayList;
import java.util.List;

public class AbundantOddNumbers {
    private static List<Integer> list = new ArrayList<>();
    private static List<Integer> result = new ArrayList<>();

    public static void main(String[] args) {
        System.out.println("First 25: ");
        abundantOdd(1,100000, 25, false);

        System.out.println("\n\nThousandth: ");
        abundantOdd(1,2500000, 1000, true);

        System.out.println("\n\nFirst over 1bn:"); 
        abundantOdd(1000000001, 2147483647, 1, false);
    }
    private static void abundantOdd(int start, int finish, int listSize, boolean printOne) {
        for (int oddNum = start; oddNum < finish; oddNum += 2) {
            list.clear();
            for (int toDivide = 1; toDivide < oddNum; toDivide+=2) {
                if (oddNum % toDivide == 0)
                    list.add(toDivide);
            }
            if (sumList(list) > oddNum) {
                if(!printOne)
                    System.out.printf("%5d <= %5d \n",oddNum, sumList(list) );
                result.add(oddNum);
            }
            if(printOne && result.size() >= listSize)
                System.out.printf("%5d <= %5d \n",oddNum, sumList(list) );

            if(result.size() >= listSize) break;
        }
    }
    private static int sumList(List list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            String temp = list.get(i).toString();
            sum += Integer.parseInt(temp);
        }
        return sum;
    }
}
Output:
First 25: 
  945 <=   975 
 1575 <=  1649 
 2205 <=  2241 
 2835 <=  2973 
 3465 <=  4023 
 4095 <=  4641 
 4725 <=  5195 
 5355 <=  5877 
 5775 <=  6129 
 5985 <=  6495 
 6435 <=  6669 
 6615 <=  7065 
 6825 <=  7063 
 7245 <=  7731 
 7425 <=  7455 
 7875 <=  8349 
 8085 <=  8331 
 8415 <=  8433 
 8505 <=  8967 
 8925 <=  8931 
 9135 <=  9585 
 9555 <=  9597 
 9765 <= 10203 
10395 <= 12645 
11025 <= 11946 

Thousandth: 
492975 <= 519361

First over 1bn:
1000000575 <= 1083561009 

JavaScript[edit]

ES6[edit]

Composing reusable functions and generators:

Translation of: Python
(() => {
    'use strict';
    const main = () => {

        // abundantTuple :: Int -> [(Int, Int)]
        const abundantTuple = n => {
            // Either a list containing the tuple of N
            // and its divisor sum (if n is abundant),
            // or otherwise an empty list.
            const x = divisorSum(n);
            return n < x ? ([
                Tuple(n)(x)
            ]) : [];
        };

        // divisorSum :: Int -> Int
        const divisorSum = n => {
            // Sum of the divisors of n.
            const
                floatRoot = Math.sqrt(n),
                intRoot = Math.floor(floatRoot),
                lows = filter(x => 0 === n % x)(
                    enumFromTo(1)(intRoot)
                );
            return sum(lows.concat(map(quot(n))(
                intRoot === floatRoot ? (
                    lows.slice(1, -1)
                ) : lows.slice(1)
            )));
        };

        // TEST ---------------------------------------
        console.log(
            'First 25 abundant odd numbers, with their divisor sums:'
        )
        console.log(unlines(map(showTuple)(
            take(25)(
                concatMapGen(abundantTuple)(
                    enumFromThen(1)(3)
                )
            )
        )));
        console.log(
            '\n\n1000th abundant odd number, with its divisor sum:'
        )
        console.log(showTuple(
            take(1)(drop(999)(
                concatMapGen(abundantTuple)(
                    enumFromThen(1)(3)
                )
            ))[0]
        ))
        console.log(
            '\n\nFirst abundant odd number above 10^9, with divisor sum:'
        )
        const billion = Math.pow(10, 9);
        console.log(showTuple(
            take(1)(
                concatMapGen(abundantTuple)(
                    enumFromThen(1 + billion)(3 + billion)
                )
            )[0]
        ))
    };


    // GENERAL REUSABLE FUNCTIONS -------------------------

    // Tuple (,) :: a -> b -> (a, b)
    const Tuple = a => b => ({
        type: 'Tuple',
        '0': a,
        '1': b,
        length: 2
    });

    // concatMapGen :: (a -> [b]) -> Gen [a] -> Gen [b]
    const concatMapGen = f =>
        function*(xs) {
            let
                x = xs.next(),
                v = undefined;
            while (!x.done) {
                v = f(x.value);
                if (0 < v.length) {
                    yield v[0];
                }
                x = xs.next();
            }
        };

    // drop :: Int -> [a] -> [a]
    // drop :: Int -> Generator [a] -> Generator [a]
    // drop :: Int -> String -> String
    const drop = n => xs =>
        Infinity > length(xs) ? (
            xs.slice(n)
        ) : (take(n)(xs), xs);

    // dropAround :: (a -> Bool) -> [a] -> [a]
    // dropAround :: (Char -> Bool) -> String -> String
    const dropAround = p => xs => dropWhile(p)(
        dropWhileEnd(p)(xs)
    );

    // dropWhile :: (a -> Bool) -> [a] -> [a]
    // dropWhile :: (Char -> Bool) -> String -> String
    const dropWhile = p => xs => {
        const lng = xs.length;
        return 0 < lng ? xs.slice(
            until(i => i === lng || !p(xs[i]))(
                i => 1 + i
            )(0)
        ) : [];
    };

    // dropWhileEnd :: (a -> Bool) -> [a] -> [a]
    // dropWhileEnd :: (Char -> Bool) -> String -> String
    const dropWhileEnd = p => xs => {
        let i = xs.length;
        while (i-- && p(xs[i])) {}
        return xs.slice(0, i + 1);
    };

    // enumFromThen :: Int -> Int -> Gen [Int]
    const enumFromThen = x =>
        // A non-finite stream of integers,
        // starting with x and y, and continuing
        // with the same interval.
        function*(y) {
            const d = y - x;
            let v = y + d;
            yield x;
            yield y;
            while (true) {
                yield v;
                v = d + v;
            }
        };

    // enumFromTo :: Int -> Int -> [Int]
    const enumFromTo = m => n =>
        Array.from({
            length: 1 + n - m
        }, (_, i) => m + i);

    // filter :: (a -> Bool) -> [a] -> [a]
    const filter = f => xs => xs.filter(f);

    // Returns Infinity over objects without finite length.
    // This enables zip and zipWith to choose the shorter
    // argument when one is non-finite, like cycle, repeat etc

    // length :: [a] -> Int
    const length = xs =>
        (Array.isArray(xs) || 'string' === typeof xs) ? (
            xs.length
        ) : Infinity;

    // map :: (a -> b) -> [a] -> [b]
    const map = f => xs =>
        (Array.isArray(xs) ? (
            xs
        ) : xs.split('')).map(f);

    // quot :: Int -> Int -> Int
    const quot = n => m => Math.floor(n / m);

    // show :: a -> String
    const show = JSON.stringify;

    // showTuple :: Tuple -> String
    const showTuple = tpl =>
        '(' + enumFromTo(0)(tpl.length - 1)
        .map(x => unQuoted(show(tpl[x])))
        .join(',') + ')';

    // sum :: [Num] -> Num
    const sum = xs => xs.reduce((a, x) => a + x, 0);

    // take :: Int -> [a] -> [a]
    // take :: Int -> String -> String
    const take = n => xs =>
        'GeneratorFunction' !== xs.constructor.constructor.name ? (
            xs.slice(0, n)
        ) : [].concat.apply([], Array.from({
            length: n
        }, () => {
            const x = xs.next();
            return x.done ? [] : [x.value];
        }));

    // unlines :: [String] -> String
    const unlines = xs => xs.join('\n');

    // until :: (a -> Bool) -> (a -> a) -> a -> a
    const until = p => f => x => {
        let v = x;
        while (!p(v)) v = f(v);
        return v;
    };

    // unQuoted :: String -> String
    const unQuoted = s =>
        dropAround(x => 34 === x.codePointAt(0))(
            s
        );

    // MAIN ---
    return main();
})();
Output:
First 25 abundant odd numbers, with their divisor sums:
(945,975)
(1575,1649)
(2205,2241)
(2835,2973)
(3465,4023)
(4095,4641)
(4725,5195)
(5355,5877)
(5775,6129)
(5985,6495)
(6435,6669)
(6615,7065)
(6825,7063)
(7245,7731)
(7425,7455)
(7875,8349)
(8085,8331)
(8415,8433)
(8505,8967)
(8925,8931)
(9135,9585)
(9555,9597)
(9765,10203)
(10395,12645)
(11025,11946)

1000th abundant odd number, with its divisor sum:
(492975,519361)

First abundant odd number above 10^9, with divisor sum:
(1000000575,1083561009)

jq[edit]

# The factors, unsorted
def factors:
  . as $num
  | reduce range(1; 1 + sqrt|floor) as $i
      ([];
       if ($num % $i) == 0 then
         ($num / $i) as $r
         | if $i == $r then . + [$i] else . + [$i, $r] end
       else . 
       end) ;

def abundant_odd_numbers:
  range(1; infinite; 2)
  | (factors | add) as $sum
  | select($sum > 2*.)
  | [., $sum] ;

Computing the first abundant number greater than 10^9 is presently impractical using jq, but for the other tasks:

( ["n", "sum of divisors"],
  limit(25; abundant_odd_numbers)),
  [],
(["The 1000th abundant odd number and corresponding sum of divisors:"]
 + nth(999; abundant_odd_numbers))
| @tsv
Output:
n	sum of divisors
945	1920
1575	3224
2205	4446
2835	5808
3465	7488
4095	8736
4725	9920
5355	11232
5775	11904
5985	12480
6435	13104
6615	13680
6825	13888
7245	14976
7425	14880
7875	16224
8085	16416
8415	16848
8505	17472
8925	17856
9135	18720
9555	19152
9765	19968
10395	23040
11025	22971

The 1000th abundant odd number and corresponding sum of divisors:	492975	1012336

Julia[edit]

using Primes

function propfact(n)
    f = [one(n)]
    for (p, x) in factor(n)
        f = reduce(vcat, [f*p^i for i in 1:x], init=f)
    end
    pop!(f)
    sort(f)
end

isabundant(n) = sum(propfact(n)) > n
prettyprintfactors(n) = (a = propfact(n); println("$n has proper divisors $a, these sum to $(sum(a))."))

function oddabundantsfrom(startingint, needed, nprint=0)
    n = isodd(startingint) ? startingint : startingint + 1
    count = one(n)
    while count <= needed
        if isabundant(n)
            if nprint == 0
                prettyprintfactors(n)
            elseif nprint == count
                prettyprintfactors(n)
            end
            count += 1
        end
        n += 2
    end
end

println("First 25 abundant odd numbers:")
oddabundantsfrom(2, 25)

println("The thousandth abundant odd number:")
oddabundantsfrom(2, 1001, 1000)

println("The first abundant odd number greater than one billion:")
oddabundantsfrom(1000000000, 1)
Output:
First 25 abundant odd numbers:
945 has proper divisors [1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 63, 105, 135, 189, 315], these sum to 975.
1575 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 63, 75, 105, 175, 225, 315, 525], these sum to 1649.
2205 has proper divisors [1, 3, 5, 7, 9, 15, 21, 35, 45, 49, 63, 105, 147, 245, 315, 441, 735], these sum to 2241.
2835 has proper divisors [1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 63, 81, 105, 135, 189, 315, 405, 567, 945], these sum to 2973.
3465 has proper divisors [1, 3, 5, 7, 9, 11, 15, 21, 33, 35, 45, 55, 63, 77, 99, 105, 165, 231, 315, 385, 495, 693, 1155], these sum to 4023.
4095 has proper divisors [1, 3, 5, 7, 9, 13, 15, 21, 35, 39, 45, 63, 65, 91, 105, 117, 195, 273, 315, 455, 585, 819, 1365], these sum to 4641.
4725 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 27, 35, 45, 63, 75, 105, 135, 175, 189, 225, 315, 525, 675, 945, 1575], these sum to 5195.
5355 has proper divisors [1, 3, 5, 7, 9, 15, 17, 21, 35, 45, 51, 63, 85, 105, 119, 153, 255, 315, 357, 595, 765, 1071, 1785], these sum to 5877.
5775 has proper divisors [1, 3, 5, 7, 11, 15, 21, 25, 33, 35, 55, 75, 77, 105, 165, 175, 231, 275, 385, 525, 825, 1155, 1925], these sum to 6129.
5985 has proper divisors [1, 3, 5, 7, 9, 15, 19, 21, 35, 45, 57, 63, 95, 105, 133, 171, 285, 315, 399, 665, 855, 1197, 1995], these sum to 6495.
6435 has proper divisors [1, 3, 5, 9, 11, 13, 15, 33, 39, 45, 55, 65, 99, 117, 143, 165, 195, 429, 495, 585, 715, 1287, 2145], these sum to 6669.
6615 has proper divisors [1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 49, 63, 105, 135, 147, 189, 245, 315, 441, 735, 945, 1323, 2205], these sum to 7065.
6825 has proper divisors [1, 3, 5, 7, 13, 15, 21, 25, 35, 39, 65, 75, 91, 105, 175, 195, 273, 325, 455, 525, 975, 1365, 2275], these sum to 7063.
7245 has proper divisors [1, 3, 5, 7, 9, 15, 21, 23, 35, 45, 63, 69, 105, 115, 161, 207, 315, 345, 483, 805, 1035, 1449, 2415], these sum to 7731.
7425 has proper divisors [1, 3, 5, 9, 11, 15, 25, 27, 33, 45, 55, 75, 99, 135, 165, 225, 275, 297, 495, 675, 825, 1485, 2475], these sum to 7455.
7875 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 63, 75, 105, 125, 175, 225, 315, 375, 525, 875, 1125, 1575, 2625], these sum to 8349.
8085 has proper divisors [1, 3, 5, 7, 11, 15, 21, 33, 35, 49, 55, 77, 105, 147, 165, 231, 245, 385, 539, 735, 1155, 1617, 2695], these sum to 8331.
8415 has proper divisors [1, 3, 5, 9, 11, 15, 17, 33, 45, 51, 55, 85, 99, 153, 165, 187, 255, 495, 561, 765, 935, 1683, 2805], these sum to 8433.
8505 has proper divisors [1, 3, 5, 7, 9, 15, 21, 27, 35, 45, 63, 81, 105, 135, 189, 243, 315, 405, 567, 945, 1215, 1701, 2835], these sum to 8967.
8925 has proper divisors [1, 3, 5, 7, 15, 17, 21, 25, 35, 51, 75, 85, 105, 119, 175, 255, 357, 425, 525, 595, 1275, 1785, 2975], these sum to 8931.
9135 has proper divisors [1, 3, 5, 7, 9, 15, 21, 29, 35, 45, 63, 87, 105, 145, 203, 261, 315, 435, 609, 1015, 1305, 1827, 3045], these sum to 9585.
9555 has proper divisors [1, 3, 5, 7, 13, 15, 21, 35, 39, 49, 65, 91, 105, 147, 195, 245, 273, 455, 637, 735, 1365, 1911, 3185], these sum to 9597.
9765 has proper divisors [1, 3, 5, 7, 9, 15, 21, 31, 35, 45, 63, 93, 105, 155, 217, 279, 315, 465, 651, 1085, 1395, 1953, 3255], these sum to 10203.
10395 has proper divisors [1, 3, 5, 7, 9, 11, 15, 21, 27, 33, 35, 45, 55, 63, 77, 99, 105, 135, 165, 189, 231, 297, 315, 385, 495, 693, 945, 1155, 1485, 2079, 3465], these sum to 12645.
11025 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 49, 63, 75, 105, 147, 175, 225, 245, 315, 441, 525, 735, 1225, 1575, 2205, 3675], these sum to 11946.
The thousandth abundant odd number:
492975 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 63, 75, 105, 175, 225, 313, 315, 525, 939, 1565, 1575, 2191, 2817, 4695, 6573, 7825, 10955, 14085, 19719, 23475, 32865, 54775, 70425, 98595, 164325], these sum to 519361.
The first abundant odd number greater than one billion:
1000000575 has proper divisors [1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 49, 63, 75, 105, 147, 175, 225, 245, 315, 441, 525, 735, 1225, 1575, 2205, 3675, 11025, 90703, 272109, 453515, 634921, 816327, 1360545, 1904763, 2267575, 3174605, 4081635, 4444447, 5714289, 6802725, 9523815, 13333341, 15873025, 20408175, 22222235, 28571445, 40000023, 47619075, 66666705, 111111175, 142857225, 200000115, 333333525], these sum to 1083561009.

Kotlin[edit]

Translation of: D
fun divisors(n: Int): List<Int> {
    val divs = mutableListOf(1)
    val divs2 = mutableListOf<Int>()

    var i = 2
    while (i * i <= n) {
        if (n % i == 0) {
            val j = n / i
            divs.add(i)
            if (i != j) {
                divs2.add(j)
            }
        }
        i++
    }

    divs.addAll(divs2.reversed())

    return divs
}

fun abundantOdd(searchFrom: Int, countFrom: Int, countTo: Int, printOne: Boolean): Int {
    var count = countFrom
    var n = searchFrom

    while (count < countTo) {
        val divs = divisors(n)
        val tot = divs.sum()
        if (tot > n) {
            count++
            if (!printOne || count >= countTo) {
                val s = divs.joinToString(" + ")
                if (printOne) {
                    println("$n < $s = $tot")
                } else {
                    println("%2d. %5d < %s = %d".format(count, n, s, tot))
                }
            }
        }

        n += 2
    }

    return n
}


fun main() {
    val max = 25
    println("The first $max abundant odd numbers are:")
    val n = abundantOdd(1, 0, 25, false)

    println("\nThe one thousandth abundant odd number is:")
    abundantOdd(n, 25, 1000, true)

    println("\nThe first abundant odd number above one billion is:")
    abundantOdd((1e9 + 1).toInt(), 0, 1, true)
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Lobster[edit]

Translation of: C
// Note that the following function is for odd numbers only
// Use "for (unsigned i = 2; i*i <= n; i++)" for even and odd numbers

def sum_proper_divisors_of_odd(n: int) -> int:
    var sum = 1
    var i = 3
    let limit = sqrt(n) + 1
    while i < limit:
        if n % i == 0:
            sum += i
            let j = n / i
            if i != j:
                sum += j
        i += 2
    return sum

def abundant_odd_numbers():
    var n = 1
    var c = 0
    print "index: number proper_sum"
    while c < 25:
        let s = sum_proper_divisors_of_odd(n)
        if n < s:
            c += 1
            print concat_string([string(c), ": ", string(n), ", ", string(s)], "")
        n += 2
    var s = 1
    while c < 1000:
        s = sum_proper_divisors_of_odd(n)
        if n < s:
            c += 1
        n += 2
    print concat_string(["1000: ", string(n), ", ", string(s)], "")
    n =  999999999
    while n >= s:
        n += 2
        s = sum_proper_divisors_of_odd(n)
    print concat_string(["The first abundant odd number above one billion is: ", string(n), ", ", string(s)], "")


abundant_odd_numbers()
Output:
index: number proper_sum
1: 945, 975
2: 1575, 1649
3: 2205, 2241
4: 2835, 2973
5: 3465, 4023
6: 4095, 4641
7: 4725, 5195
8: 5355, 5877
9: 5775, 6129
10: 5985, 6495
11: 6435, 6669
12: 6615, 7065
13: 6825, 7063
14: 7245, 7731
15: 7425, 7455
16: 7875, 8349
17: 8085, 8331
18: 8415, 8433
19: 8505, 8967
20: 8925, 8931
21: 9135, 9585
22: 9555, 9597
23: 9765, 10203
24: 10395, 12645
25: 11025, 11946
1000: 492977, 519361
The first abundant odd number above one billion is: 1000000575, 1083561009

Lua[edit]

-- Return the sum of the proper divisors of x
function sumDivs (x)
  local sum, sqr = 1, math.sqrt(x)
  for d = 2, sqr do
    if x % d == 0 then
      sum = sum + d
      if d ~= sqr then sum = sum + (x/d) end
    end
  end
  return sum
end

-- Return a table of odd abundant numbers
function oddAbundants (mode, limit)
  local n, count, divlist, divsum = 1, 0, {}
  repeat
    n = n + 2
    divsum = sumDivs(n)
    if divsum > n then
      table.insert(divlist, {n, divsum})
      count = count + 1
      if mode == "Above" and n > limit then return divlist[#divlist] end
    end
  until count == limit
  if mode == "First" then return divlist end
  if mode == "Nth" then return divlist[#divlist] end
end

-- Write a result to stdout
function showResult (msg, t)
  print(msg .. ": the proper divisors of " .. t[1] .. " sum to " .. t[2])
end

-- Main procedure
for k, v in pairs(oddAbundants("First", 25)) do  showResult(k, v) end
showResult("1000", oddAbundants("Nth", 1000))
showResult("Above 1e6", oddAbundants("Above", 1e6))
Output:
1: the proper divisors of 945 sum to 975
2: the proper divisors of 1575 sum to 1649
3: the proper divisors of 2205 sum to 2241
4: the proper divisors of 2835 sum to 2973
5: the proper divisors of 3465 sum to 4023
6: the proper divisors of 4095 sum to 4641
7: the proper divisors of 4725 sum to 5195
8: the proper divisors of 5355 sum to 5877
9: the proper divisors of 5775 sum to 6129
10: the proper divisors of 5985 sum to 6495
11: the proper divisors of 6435 sum to 6669
12: the proper divisors of 6615 sum to 7065
13: the proper divisors of 6825 sum to 7063
14: the proper divisors of 7245 sum to 7731
15: the proper divisors of 7425 sum to 7455
16: the proper divisors of 7875 sum to 8349
17: the proper divisors of 8085 sum to 8331
18: the proper divisors of 8415 sum to 8433
19: the proper divisors of 8505 sum to 8967
20: the proper divisors of 8925 sum to 8931
21: the proper divisors of 9135 sum to 9585
22: the proper divisors of 9555 sum to 9597
23: the proper divisors of 9765 sum to 10203
24: the proper divisors of 10395 sum to 12645
25: the proper divisors of 11025 sum to 11946
1000: the proper divisors of 492975 sum to 519361
Above 1e6: the proper divisors of 1000125 sum to 1076547

MAD[edit]

            NORMAL MODE IS INTEGER
            
            INTERNAL FUNCTION(ND)
            ENTRY TO ODDSUM.
            SUM = 1
            SQN = SQRT.(ND)
            THROUGH CHECK, FOR CN=3, 2, CN.G.SQN
            TM = ND/CN
            WHENEVER TM*CN.E.ND
                SUM = SUM + CN
                WHENEVER TM.NE.CN, SUM = SUM + TM
CHECK       END OF CONDITIONAL
            FUNCTION RETURN SUM
            END OF FUNCTION
            
            SEEN = 0
            NUM = 1
            
            THROUGH SHOW, FOR NUM=1, 2, SEEN.G.1000
            WHENEVER NUM.L.ODDSUM.(NUM)
                SEEN = SEEN + 1
                WHENEVER SEEN.LE.25 .OR. SEEN.E.1000, 
          0         PRINT FORMAT OUTFMT,SEEN,NUM,ODDSUM.(NUM)
SHOW        END OF CONDITIONAL
   
BILION      THROUGH BILION, FOR NUM=NUM, 2, 
          0     NUM.G.1000000000 .AND. NUM.L.ODDSUM.(NUM)
      
            PRINT FORMAT HUGENO,NUM,ODDSUM.(NUM)
            
            VECTOR VALUES OUTFMT = 
          0     $4HNO. ,I4,S1,3HIS ,I6,S1,7HDIVSUM ,I6*$
            VECTOR VALUES HUGENO = 
          0     $25HFIRST ABOVE 1 BILLION IS ,I10,S1,7HDIVSUM ,I10*$
            END OF PROGRAM
Output:
NO.    1 IS    945 DIVSUM    975
NO.    2 IS   1575 DIVSUM   1649
NO.    3 IS   2205 DIVSUM   2241
NO.    4 IS   2835 DIVSUM   2973
NO.    5 IS   3465 DIVSUM   4023
NO.    6 IS   4095 DIVSUM   4641
NO.    7 IS   4725 DIVSUM   5195
NO.    8 IS   5355 DIVSUM   5877
NO.    9 IS   5775 DIVSUM   6129
NO.   10 IS   5985 DIVSUM   6495
NO.   11 IS   6435 DIVSUM   6669
NO.   12 IS   6615 DIVSUM   7065
NO.   13 IS   6825 DIVSUM   7063
NO.   14 IS   7245 DIVSUM   7731
NO.   15 IS   7425 DIVSUM   7455
NO.   16 IS   7875 DIVSUM   8349
NO.   17 IS   8085 DIVSUM   8331
NO.   18 IS   8415 DIVSUM   8433
NO.   19 IS   8505 DIVSUM   8967
NO.   20 IS   8925 DIVSUM   8931
NO.   21 IS   9135 DIVSUM   9585
NO.   22 IS   9555 DIVSUM   9597
NO.   23 IS   9765 DIVSUM  10203
NO.   24 IS  10395 DIVSUM  12645
NO.   25 IS  11025 DIVSUM  11946
NO. 1000 IS 492975 DIVSUM 519361
FIRST ABOVE 1 BILLION IS 1000000575 DIVSUM 1083561009


Maple[edit]

with(NumberTheory):

# divisorSum returns the sum of the divisors of x not including x
divisorSum := proc(x::integer)
 return SumOfDivisors(x) - x;
end proc:


# abundantNumber returns true if x is an abundant number and false otherwise
abundantNumber := proc(x::integer)
 if (SumOfDivisors(x) > 2*x) then return true
 else return false end if;
end proc:

count := 0:
number := 1:

cat("First 25 abundant odd numbers");

while count < 25 do
 if (abundantNumber(number)) then
  count += 1:
  print(cat(count, ": ", number, " sum of divisors  ", SumOfDivisors(number), " sum of proper divisors ", divisorSum(number)));
 else end if;
 number += 2:
end:

while (count < 1000) do
 if (abundantNumber(number)) then
  count += 1:
 else end if:
 number += 2:
end:

cat("The 1000th odd abundant number is ", number - 2, ", its sum of divisors is ", SumOfDivisors(number - 2), ", and its sum of proper divisors is ", divisorSum(number - 2));

for number from 10^9 + 1 by 2 to infinity while not abundantNumber(number) do end:

cat("First abundant odd number > 10^9 is ", number, ", its sum of divisors is  ", SumOfDivisors(number), ", and its sum of proper divisors is  ",divisorSum(number));
Output:

                                                                                      "First 25 abundant odd numbers"
                                                                          1: 945 sum of divisors  1920 sum of proper divisors 975
                                                                         2: 1575 sum of divisors  3224 sum of proper divisors 1649
                                                                         3: 2205 sum of divisors  4446 sum of proper divisors 2241
                                                                         4: 2835 sum of divisors  5808 sum of proper divisors 2973
                                                                         5: 3465 sum of divisors  7488 sum of proper divisors 4023
                                                                         6: 4095 sum of divisors  8736 sum of proper divisors 4641
                                                                         7: 4725 sum of divisors  9920 sum of proper divisors 5195
                                                                         8: 5355 sum of divisors  11232 sum of proper divisors 5877
                                                                         9: 5775 sum of divisors  11904 sum of proper divisors 6129
                                                                        10: 5985 sum of divisors  12480 sum of proper divisors 6495
                                                                        11: 6435 sum of divisors  13104 sum of proper divisors 6669
                                                                        12: 6615 sum of divisors  13680 sum of proper divisors 7065
                                                                        13: 6825 sum of divisors  13888 sum of proper divisors 7063
                                                                        14: 7245 sum of divisors  14976 sum of proper divisors 7731
                                                                        15: 7425 sum of divisors  14880 sum of proper divisors 7455
                                                                        16: 7875 sum of divisors  16224 sum of proper divisors 8349
                                                                        17: 8085 sum of divisors  16416 sum of proper divisors 8331
                                                                        18: 8415 sum of divisors  16848 sum of proper divisors 8433
                                                                        19: 8505 sum of divisors  17472 sum of proper divisors 8967
                                                                        20: 8925 sum of divisors  17856 sum of proper divisors 8931
                                                                        21: 9135 sum of divisors  18720 sum of proper divisors 9585
                                                                        22: 9555 sum of divisors  19152 sum of proper divisors 9597
                                                                        23: 9765 sum of divisors  19968 sum of proper divisors 10203
                                                                       24: 10395 sum of divisors  23040 sum of proper divisors 12645
                                                                       25: 11025 sum of divisors  22971 sum of proper divisors 11946
                                            "The 1000th odd abundant number is 492975, its sum of divisors is 1012336, and its sum of proper divisors is 519361"
                                    "First abundant odd number > 10^9 is 1000000575, its sum of divisors is  2083561584, and its sum of proper divisors is  1083561009"

Mathematica/Wolfram Language[edit]

ClearAll[AbundantQ]
AbundantQ[n_] := TrueQ[Greater[Total @ Most @ Divisors @ n, n]]
res = {};
i = 1;
While[Length[res] < 25,
  If[AbundantQ[i],
   AppendTo[res, {i, Total @ Most @ Divisors @ i}];
   ];
  i += 2;
  ];
res

res = {};
i = 1;
While[Length[res] < 1000,
  If[AbundantQ[i],
   AppendTo[res, {i, Total @ Most @ Divisors @ i}];
   ];
  i += 2;
  ];
res[[-1]]

res = {};
i = 1000000001;
While[Length[res] < 1,
  If[AbundantQ[i],
   AppendTo[res, {i, Total @ Most @ Divisors @ i}];
   ];
  i += 2;
  ];
res
Output:
{{945,975},{1575,1649},{2205,2241},{2835,2973},{3465,4023},{4095,4641},{4725,5195},{5355,5877},{5775,6129},{5985,6495},{6435,6669},{6615,7065},{6825,7063},{7245,7731},{7425,7455},{7875,8349},{8085,8331},{8415,8433},{8505,8967},{8925,8931},{9135,9585},{9555,9597},{9765,10203},{10395,12645},{11025,11946}}
{492975, 519361}
{{1000000575,1083561009}}

Maxima[edit]

block([k: 0, n: 1, l: []],
    while k < 25 do (
        n: n+2,
        if divsum(n,-1) > 2 then (
            k: k+1,
            l: append(l, [[n,divsum(n)]])
        )
    ),
    return(l)
);
Output:
[[945,1920],[1575,3224],[2205,4446],[2835,5808],[3465,7488],[4095,8736],[4725,9920],[5355,11232],[5775,11904],[5985,12480],[6435,13104],[6615,13680],[6825,13888],[7245,14976],[7425,14880],[7875,16224],[8085,16416],[8415,16848],[8505,17472],[8925,17856],[9135,18720],[9555,19152],[9765,19968],[10395,23040],[11025,22971]]
block([k: 0, n: 1],
    while k < 1000 do (
        n: n+2,
        if divsum(n,1) > 2*n then k: k+1
    ),
    return([n,divsum(n)])
);
Output:
[492975,1012336]
block([n: 5, l: [5], r: divsum(n,-1)],
    while n < 10^8 do (
        if not mod(n,3)=0 then (
            s: divsum(n,-1),
            if s > r then (r: s, l: append(l, [n]))
        ),
        n: n+10
    ),
    return(l)
);
Output:
[5,25,35,175,385,1925,5005,25025,85085,425425,1616615,8083075,37182145,56581525]

Nim[edit]

from math import sqrt
import strformat

#---------------------------------------------------------------------------------------------------

proc sumProperDivisors(n: int): int =
  ## Compute the sum of proper divisors.
  ## "n" is supposed to be odd.
  result = 1
  for d in countup(3, sqrt(n.toFloat).int, 2):
    if n mod d == 0:
      inc result, d
      if n div d != d:
        inc result, n div d

#---------------------------------------------------------------------------------------------------

iterator oddAbundant(start: int): tuple[n, s: int] =
  ## Yield the odd abundant numbers and the sum of their proper
  ## divisors greater or equal to "start".
  var n = start + (start and 1 xor 1)   # Start with an odd number.
  while true:
    let s = n.sumProperDivisors()
    if s > n:
      yield (n, s)
    inc n, 2

#---------------------------------------------------------------------------------------------------

echo "List of 25 first odd abundant numbers."
echo "Rank  Number  Proper divisors sum"
echo "----  -----   -------------------"
var rank = 0
for (n, s) in oddAbundant(1):
  inc rank
  echo fmt"{rank:2}:   {n:5}   {s:5}"
  if rank == 25:
    break

echo ""
rank = 0
for (n, s) in oddAbundant(1):
  inc rank
  if rank == 1000:
    echo fmt"The 1000th odd abundant number is {n}."
    echo fmt"The sum of its proper divisors is {s}."
    break

echo ""
for (n, s) in oddAbundant(1_000_000_000):
  if n > 1_000_000_000:
    echo fmt"The first odd abundant number greater than 1000000000 is {n}."
    echo fmt"The sum of its proper divisors is {s}."
    break
Output:
List of 25 first odd abundant numbers.
Rank  Number  Proper divisors sum
----  -----   -------------------
 1:     945     975
 2:    1575    1649
 3:    2205    2241
 4:    2835    2973
 5:    3465    4023
 6:    4095    4641
 7:    4725    5195
 8:    5355    5877
 9:    5775    6129
10:    5985    6495
11:    6435    6669
12:    6615    7065
13:    6825    7063
14:    7245    7731
15:    7425    7455
16:    7875    8349
17:    8085    8331
18:    8415    8433
19:    8505    8967
20:    8925    8931
21:    9135    9585
22:    9555    9597
23:    9765   10203
24:   10395   12645
25:   11025   11946

The 1000th odd abundant number is 492975.
The sum of its proper divisors is 519361.

The first odd abundant number greater than 1000000000 is 1000000575.
The sum of its proper divisors is 1083561009.

Pari/GP[edit]

genit(brk1,brk2,brk3)={tcnt=0;
print("First 25 abundant odd numbers:");
forstep(n=1,999999999999999999,2,
if(tcnt==brk2&&n<brk3,next);
if(sigma(n)<=2*n,next); 
tcnt+=1; 
if(tcnt>brk1&&tcnt<brk2,next);
if(n>=brk3 && sigma(n)>2*n,print("The first odd abundant number greater than 1000000000 is ",n," with sigma = ",sigma(n) );break);
if(tcnt==brk2,print("The 1000th odd abundant number is ",n," with sigma = ",sigma(n) );next);
print(n," with sigma = ",sigma(n)));}

Output:

(11:14) gp > genit(25,1000,1000000000 )
First 25 abundant odd numbers:
945 with sigma = 1920
1575 with sigma = 3224
2205 with sigma = 4446
2835 with sigma = 5808
3465 with sigma = 7488
4095 with sigma = 8736
4725 with sigma = 9920
5355 with sigma = 11232
5775 with sigma = 11904
5985 with sigma = 12480
6435 with sigma = 13104
6615 with sigma = 13680
6825 with sigma = 13888
7245 with sigma = 14976
7425 with sigma = 14880
7875 with sigma = 16224
8085 with sigma = 16416
8415 with sigma = 16848
8505 with sigma = 17472
8925 with sigma = 17856
9135 with sigma = 18720
9555 with sigma = 19152
9765 with sigma = 19968
10395 with sigma = 23040
11025 with sigma = 22971
The 1000th odd abundant number is 492975 with sigma = 1012336
The first odd abundant number greater than 1000000000 is 1000000575 with sigma = 2083561584
(11:24) gp >

Pascal[edit]

Works with: Free Pascal
Works with: Delphi
program AbundantOddNumbers;
{$IFDEF FPC}
   {$MODE DELPHI}{$OPTIMIZATION ON,ALL}{$CODEALIGN proc=16}{$ALIGN 16}
{$ELSE}
  {$APPTYPE CONSOLE}
{$ENDIF}
{geeksforgeeks
*    1100 = 2^2*5^2*11^1
    (2^0 + 2^1 + 2^2) * (5^0 + 5^1 + 5^2) * (11^0 + 11^1)
    (upto the power of factor in factorization i.e. power of 2 and 5 is 2 and 11 is 1.)
    = (1 + 2 + 2^2) * (1 + 5 + 5^2) * (1 + 11)
    = 7 * 31 * 12
    = 2604
    So, sum of all factors of 1100 = 2604 }
uses
  SysUtils;
var
  //all primes < 2^16=65536
  primes : array[0..6541] of Word;

procedure InitPrimes;
//sieve of erathotenes
var
  p : array[word] of byte;
  i,j : NativeInt;
Begin
  fillchar(p,SizeOf(p),#0);
  p[0] := 1;
  p[1] := 1;
  For i := 2 to high(p) do
    if p[i] = 0 then
    begin
      j := i*i;
      IF j>high(p) then
        BREAK;
      while j <= High(p) do
      begin
        p[j] := 1;
        inc(j,i);
      end;
    end;
  j := 0;
  For i := 2 to high(p) do
    IF p[i] = 0 then
    Begin
      primes[j] := i;
      inc(j);
    end;
end;

function PotToString(N: NativeUint):String;
var
  pN,pr,PowerPr,rest : NativeUint;
begin
  pN := 0; //starting at 2;
  Result := '';
  repeat
    pr := primes[pN];
    rest := N div pr;
    if rest < pr then
      BREAK;
    //same as N MOD PR = 0
    if rest*pr = N then
    begin
      result := result+IntToStr(pr);
      N := rest;
      rest := N div pr;
      PowerPr := 1;
      while rest*pr = N do
      begin
        inc(PowerPr);
        N := rest;
        rest := N div pr;
      end;
      if PowerPr > 1 then
        result := result+'^'+IntToStr(PowerPr);
      if N > 1 then
        result := result +'*';
    end;
    inc(pN);
  until pN > High(Primes);
  //is there a last prime factor of N
  if N <> 1 then
    result := result+IntToStr(N);
end;

function OutNum(N: NativeUint):string;
Begin
  result := Format('%10u= %s', [N,PotToString(N)]);
end;

function SumProperDivisors(N: NativeUint): NativeUint;
var
  pN,pr,PowerPr,SumOfPower,rest,N0 : NativeUint;
begin
  N0 := N;
  pN := 0; //starting at 2;
  Result := 1;
  repeat
    pr := primes[pN];
    rest := N div pr;
    if rest < pr then
      BREAK;
    //same as N MOD PR = 0
    if rest*pr = N then
    begin
//      IF pr=5 then break;
//      IF pr=7 then break;
      PowerPr := 1;
      SumOfPower:= 1;
      repeat
        PowerPr := PowerPr*pr;
        inc(SumOfPower,PowerPr);
        N := rest;
        rest := N div pr;
      until N <> rest*pr;
      result := result*SumOfPower;
    end;
    inc(pN);
  until pN > High(Primes);
  //is there a last prime factor of N
  if N <> 1 then
    result := result*(N+1);
  result := result-N0;
end;

var
  C, N,N0,k: Cardinal;
begin
  InitPrimes;

  k := High(k);
  N := 1;
  N0 := N;
  C := 0;
  while C < 25 do begin
    inc(N, 2);
    if N < SumProperDivisors(N) then begin
      Inc(C);
      WriteLn(Format('%5u: %s', [C,OutNum(N)]));
      IF k > N-N0 then
        k := N-N0;
      N0 := N;
    end;
  end;
  Writeln(' Min Delta ',k);
  writeln;

  while C < 1000 do begin
    Inc(N, 2);
    if N < SumProperDivisors(N) then
    Begin
      Inc(C);
      IF k > N-N0 then
        k := N-N0;
      N0 := N;
    end;
  end;
  WriteLn(' 1000: ',OutNum(N));
  Writeln(' Min Delta ',k);
  writeln;

  while C < 10000 do begin
    Inc(N, 2);
    if N < SumProperDivisors(N) then
    Begin
      Inc(C);
      IF k > N-N0 then
        k := N-N0;
      N0 := N;
    end;
  end;
  WriteLn('10000: ',OutNum(N));
  Writeln(' Min Delta ',k);

  N := 1000000001;
  while N >= SumProperDivisors(N) do
    Inc(N, 2);
  WriteLn('The first abundant odd number above one billion is: ',OutNum(N));
end.
Output:
    1:        945= 3^3*5*7
    2:       1575= 3^2*5^2*7
    3:       2205= 3^2*5*7^2
    4:       2835= 3^4*5*7
    5:       3465= 3^2*5*7*11
    6:       4095= 3^2*5*7*13
    7:       4725= 3^3*5^2*7
    8:       5355= 3^2*5*7*17
    9:       5775= 3*5^2*7*11
   10:       5985= 3^2*5*7*19
   11:       6435= 3^2*5*11*13
   12:       6615= 3^3*5*7^2
   13:       6825= 3*5^2*7*13
   14:       7245= 3^2*5*7*23
   15:       7425= 3^3*5^2*11
   16:       7875= 3^2*5^3*7
   17:       8085= 3*5*7^2*11
   18:       8415= 3^2*5*11*17
   19:       8505= 3^5*5*7
   20:       8925= 3*5^2*7*17
   21:       9135= 3^2*5*7*29
   22:       9555= 3*5*7^2*13
   23:       9765= 3^2*5*7*31
   24:      10395= 3^3*5*7*11
   25:      11025= 3^2*5^2*7^2
 Min Delta 90

 1000:     492975= 3^2*5^2*7*313
 Min Delta 30

10000:    4913685= 3^2*5*7*19*821
 Min Delta 18
The first abundant odd number above one billion is: 1000000575= 3^2*5^2*7^2*90703

Perl[edit]

Translation of: Raku
Library: ntheory
use strict;
use warnings;
use feature 'say';
use ntheory qw/divisor_sum divisors/;

sub odd_abundants {
    my($start,$count) = @_;
    my $n = int(( $start + 2 ) / 3);
    $n   += 1 if 0 == $n % 2;
    $n   *= 3;
    my @out;
    while (@out < $count) {
        $n += 6;
        next unless (my $ds = divisor_sum($n)) > 2*$n;
        my @d = divisors($n);
        push @out, sprintf "%6d: divisor sum: %s = %d", $n, join(' + ', @d[0..@d-2]), $ds-$n;
    }
    @out;
}

say 'First 25 abundant odd numbers:';
say for odd_abundants(1, 25);
say "\nOne thousandth abundant odd number:\n", (odd_abundants(1, 1000))[999];
say "\nFirst abundant odd number above one billion:\n", odd_abundants(999_999_999, 1);
Output:
First 25 abundant odd numbers:
   945: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
  1575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
  2205: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
  2835: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
  3465: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
  4095: divisor sum: 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
  4725: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
  5355: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
  5775: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
  5985: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
  6435: divisor sum: 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
  6615: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
  6825: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
  7245: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
  7425: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
  7875: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
  8085: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
  8415: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
  8505: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
  8925: divisor sum: 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
  9135: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
  9555: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
  9765: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
 10395: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
 11025: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

One thousandth abundant odd number:
492975: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

First abundant odd number above one billion:
1000000575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Phix[edit]

function abundantOdd(integer n, done, lim, bool printAll)
    while done<lim do
        atom tot = sum(factors(n,-1))
        if tot>n then
            done += 1
            if printAll or done=lim then
                string ln = iff(printAll?sprintf("%2d. ",done):"")
                printf(1,"%s%,6d (proper sum:%,d)\n",{ln,n,tot})
            end if
        end if
        n += 2
    end while
    printf(1,"\n")
    return n
end function
printf(1,"The first 25 abundant odd numbers are:\n")
integer n = abundantOdd(1, 0, 25, true)
printf(1,"The one thousandth abundant odd number is:")
{} = abundantOdd(n, 25, 1000, false)
printf(1,"The first abundant odd number above one billion is:")
{} = abundantOdd(1e9+1, 0, 1, false)
Output:
The first 25 abundant odd numbers are:
 1.    945 (proper sum:975)
 2.  1,575 (proper sum:1,649)
 3.  2,205 (proper sum:2,241)
 4.  2,835 (proper sum:2,973)
 5.  3,465 (proper sum:4,023)
 6.  4,095 (proper sum:4,641)
 7.  4,725 (proper sum:5,195)
 8.  5,355 (proper sum:5,877)
 9.  5,775 (proper sum:6,129)
10.  5,985 (proper sum:6,495)
11.  6,435 (proper sum:6,669)
12.  6,615 (proper sum:7,065)
13.  6,825 (proper sum:7,063)
14.  7,245 (proper sum:7,731)
15.  7,425 (proper sum:7,455)
16.  7,875 (proper sum:8,349)
17.  8,085 (proper sum:8,331)
18.  8,415 (proper sum:8,433)
19.  8,505 (proper sum:8,967)
20.  8,925 (proper sum:8,931)
21.  9,135 (proper sum:9,585)
22.  9,555 (proper sum:9,597)
23.  9,765 (proper sum:10,203)
24. 10,395 (proper sum:12,645)
25. 11,025 (proper sum:11,946)

The one thousandth abundant odd number is:492,975 (proper sum:519,361)

The first abundant odd number above one billion is:1,000,000,575 (proper sum:1,083,561,009)

PicoLisp[edit]

(de accud (Var Key)
   (if (assoc Key (val Var))
      (con @ (inc (cdr @)))
      (push Var (cons Key 1)) )
   Key )
(de **sum (L)                                                                   
   (let S 1                                                                     
      (for I (cdr L)                                                            
         (inc 'S (** (car L) I)) )                                              
      S ) )        
(de factor-sum (N)
   (if (=1 N)
      0
      (let
         (R NIL
            D 2
            L (1 2 2 . (4 2 4 2 4 6 2 6 .))
            M (sqrt N)
            N1 N
            S 1 )
         (while (>= M D)
            (if (=0 (% N1 D))
               (setq M
                  (sqrt (setq N1 (/ N1 (accud 'R D)))) )
               (inc 'D (pop 'L)) ) )
         (accud 'R N1)
         (for I R
            (setq S (* S (**sum I))) )
         (- S N) ) ) )
(de factor-list NIL
   (let (N 1  C 0)
      (make
         (loop
            (when (> (setq @@ (factor-sum N)) N)
               (link (cons N @@))
               (inc 'C) )
            (inc 'N 2)
            (T (= C 1000)) ) ) ) )
(let L (factor-list)
   (for N 25
      (println N (++ L)) ) 
   (println 1000 (last L))
   (println 
      '****
      1000000575
      (factor-sum 1000000575) ) )
Output:
1 (945 . 975)
2 (1575 . 1649)
3 (2205 . 2241)
4 (2835 . 2973)
5 (3465 . 4023)
6 (4095 . 4641)
7 (4725 . 5195)
8 (5355 . 5877)
9 (5775 . 6129)
10 (5985 . 6495)
11 (6435 . 6669)
12 (6615 . 7065)
13 (6825 . 7063)
14 (7245 . 7731)
15 (7425 . 7455)
16 (7875 . 8349)
17 (8085 . 8331)
18 (8415 . 8433)
19 (8505 . 8967)
20 (8925 . 8931)
21 (9135 . 9585)
22 (9555 . 9597)
23 (9765 . 10203)
24 (10395 . 12645)
25 (11025 . 11946)
1000 (492975 . 519361)
**** 1000000575 1083561009

Processing[edit]

void setup() {
  println("First 25 abundant odd numbers: ");
  int abundant = 0;
  int i = 1;
  while (abundant < 25) {
    int sigma_sum = sigma(i);
    if (sigma_sum > 2 * i) {
      abundant++;
      println(i + "  Sigma sum: " + sigma_sum);
    }
    i += 2;
  }
  println("Thousandth abundant odd number: ");
  while (abundant < 1000) {
    int sigma_sum = sigma(i);
    if (sigma_sum > 2 * i) {
      abundant++;
      if (abundant == 1000) {
        println(i + "  Sigma sum: " + sigma_sum);
      }
    }
    i += 2;
  }
  println("First abundant odd number greater than 10^9: ");
  i = int(pow(10, 9)) + 1;
  while (!(sigma(i) > 2 * i)) {
    i += 2;
  }
  println(i + "  Sigma sum: " + sigma(i));
}

int sigma(int n) {
  int sum = 0;
  for (int i = 1; i < sqrt(n); i++) {
    if (n % i == 0) {
      sum += i + n / i;
    }
  }
  if (sqrt(n) % 1 == 0) {
    sum += sqrt(n);
  }
  return sum;
}
Output:
First 25 abundant odd numbers: 
945  Sigma sum: 1920
1575  Sigma sum: 3224
2205  Sigma sum: 4446
2835  Sigma sum: 5808
3465  Sigma sum: 7488
4095  Sigma sum: 8736
4725  Sigma sum: 9920
5355  Sigma sum: 11232
5775  Sigma sum: 11904
5985  Sigma sum: 12480
6435  Sigma sum: 13104
6615  Sigma sum: 13680
6825  Sigma sum: 13888
7245  Sigma sum: 14976
7425  Sigma sum: 14880
7875  Sigma sum: 16224
8085  Sigma sum: 16416
8415  Sigma sum: 16848
8505  Sigma sum: 17472
8925  Sigma sum: 17856
9135  Sigma sum: 18720
9555  Sigma sum: 19152
9765  Sigma sum: 19968
10395  Sigma sum: 23040
11025  Sigma sum: 22971
Thousandth abundant odd number: 
492975  Sigma sum: 1012336
First abundant odd number greater than 10^9: 
1000000575  Sigma sum: 2083561584

PureBasic[edit]

Translation of: C
NewList l_sum.i()


Procedure.i sum_proper_divisors(n.i)
  Define.i sum, i=3, j
  Shared l_sum()
  AddElement(l_sum())
  l_sum()=1
  While i<Sqr(n)+1
    If n%i=0
      sum+i
      AddElement(l_sum())
      l_sum()=i
      j=n/i
      If i<>j
        sum+j
        AddElement(l_sum())
        l_sum()=j
      EndIf
    EndIf
    i+2
  Wend
  ProcedureReturn sum+1
EndProcedure


If OpenConsole("Abundant_odd_numbers")
  Define.i n, c, s
  
  n=1
  c=0
  While c<25
    ClearList(l_sum())
    s=sum_proper_divisors(n)
    If n<s
      SortList(l_sum(),#PB_Sort_Ascending)
      c+1
      Print(RSet(Str(c),3)+": "+RSet(Str(n),6)+" -> "+RSet(Str(s),6))
      ForEach l_sum()
        If ListIndex(l_sum())=0
          Print(" = ")
        Else
          Print("+")
        EndIf        
        Print(Str(l_sum()))
      Next
      PrintN("")
    EndIf
    n+2    
  Wend  

  n-2
  While c<1000
    s=sum_proper_divisors(n+2)
    c+Bool(n<s)
    n+2
  Wend  
  PrintN(~"\nThe one thousandth abundant odd number is: "+Str(n)+
         ~"\n\tand the proper divisor sum is: "+Str(s))  
  
  n=1000000001-2
  Repeat
    n+2
    s=sum_proper_divisors(n)
  Until n<s  
  PrintN("The first abundant odd number above one billion is: "+Str(n)+
         ~"\n\tand the proper divisor sum is: "+Str(s))
  
  Input()
EndIf
Output:
  1:    945 ->    975 = 1+3+5+7+9+15+21+27+35+45+63+105+135+189+315
  2:   1575 ->   1649 = 1+3+5+7+9+15+21+25+35+45+63+75+105+175+225+315+525
  3:   2205 ->   2241 = 1+3+5+7+9+15+21+35+45+49+63+105+147+245+315+441+735
  4:   2835 ->   2973 = 1+3+5+7+9+15+21+27+35+45+63+81+105+135+189+315+405+567+945
  5:   3465 ->   4023 = 1+3+5+7+9+11+15+21+33+35+45+55+63+77+99+105+165+231+315+385+495+693+1155
  6:   4095 ->   4641 = 1+3+5+7+9+13+15+21+35+39+45+63+65+91+105+117+195+273+315+455+585+819+1365
  7:   4725 ->   5195 = 1+3+5+7+9+15+21+25+27+35+45+63+75+105+135+175+189+225+315+525+675+945+1575
  8:   5355 ->   5877 = 1+3+5+7+9+15+17+21+35+45+51+63+85+105+119+153+255+315+357+595+765+1071+1785
  9:   5775 ->   6129 = 1+3+5+7+11+15+21+25+33+35+55+75+77+105+165+175+231+275+385+525+825+1155+1925
 10:   5985 ->   6495 = 1+3+5+7+9+15+19+21+35+45+57+63+95+105+133+171+285+315+399+665+855+1197+1995
 11:   6435 ->   6669 = 1+3+5+9+11+13+15+33+39+45+55+65+99+117+143+165+195+429+495+585+715+1287+2145
 12:   6615 ->   7065 = 1+3+5+7+9+15+21+27+35+45+49+63+105+135+147+189+245+315+441+735+945+1323+2205
 13:   6825 ->   7063 = 1+3+5+7+13+15+21+25+35+39+65+75+91+105+175+195+273+325+455+525+975+1365+2275
 14:   7245 ->   7731 = 1+3+5+7+9+15+21+23+35+45+63+69+105+115+161+207+315+345+483+805+1035+1449+2415
 15:   7425 ->   7455 = 1+3+5+9+11+15+25+27+33+45+55+75+99+135+165+225+275+297+495+675+825+1485+2475
 16:   7875 ->   8349 = 1+3+5+7+9+15+21+25+35+45+63+75+105+125+175+225+315+375+525+875+1125+1575+2625
 17:   8085 ->   8331 = 1+3+5+7+11+15+21+33+35+49+55+77+105+147+165+231+245+385+539+735+1155+1617+2695
 18:   8415 ->   8433 = 1+3+5+9+11+15+17+33+45+51+55+85+99+153+165+187+255+495+561+765+935+1683+2805
 19:   8505 ->   8967 = 1+3+5+7+9+15+21+27+35+45+63+81+105+135+189+243+315+405+567+945+1215+1701+2835
 20:   8925 ->   8931 = 1+3+5+7+15+17+21+25+35+51+75+85+105+119+175+255+357+425+525+595+1275+1785+2975
 21:   9135 ->   9585 = 1+3+5+7+9+15+21+29+35+45+63+87+105+145+203+261+315+435+609+1015+1305+1827+3045
 22:   9555 ->   9597 = 1+3+5+7+13+15+21+35+39+49+65+91+105+147+195+245+273+455+637+735+1365+1911+3185
 23:   9765 ->  10203 = 1+3+5+7+9+15+21+31+35+45+63+93+105+155+217+279+315+465+651+1085+1395+1953+3255
 24:  10395 ->  12645 = 1+3+5+7+9+11+15+21+27+33+35+45+55+63+77+99+105+135+165+189+231+297+315+385+495+693+945+1155+1485+2079+3465
 25:  11025 ->  11946 = 1+3+5+7+9+15+21+25+35+45+49+63+75+105+147+175+225+245+315+441+525+735+1225+1575+2205+3675

The one thousandth abundant odd number is: 492975
	and the proper divisor sum is: 519361
The first abundant odd number above one billion is: 1000000575
	and the proper divisor sum is: 1083561009

Python[edit]

Procedural[edit]

Translation of: Visual Basic .NET
#!/usr/bin/python
# Abundant odd numbers - Python

oddNumber  = 1
aCount  = 0
dSum  = 0
 
from math import sqrt
 
def divisorSum(n):
    sum = 1
    i = int(sqrt(n)+1)
 
    for d in range (2, i):
        if n % d == 0:
            sum += d
            otherD = n // d
            if otherD != d:
                sum += otherD
    return sum
 
print ("The first 25 abundant odd numbers:")
while aCount  < 25:
    dSum  = divisorSum(oddNumber )
    if dSum  > oddNumber :
        aCount  += 1
        print("{0:5} proper divisor sum: {1}". format(oddNumber ,dSum ))
    oddNumber  += 2
 
while aCount  < 1000:
    dSum  = divisorSum(oddNumber )
    if dSum  > oddNumber :
        aCount  += 1
    oddNumber  += 2
print ("\n1000th abundant odd number:")
print ("    ",(oddNumber - 2)," proper divisor sum: ",dSum)
 
oddNumber  = 1000000001
found  = False
while not found :
    dSum  = divisorSum(oddNumber )
    if dSum  > oddNumber :
        found  = True
        print ("\nFirst abundant odd number > 1 000 000 000:")
        print ("    ",oddNumber," proper divisor sum: ",dSum)
    oddNumber  += 2
Output:
The first 25 abundant odd numbers:
  945 proper divisor sum: 975
 1575 proper divisor sum: 1649
 2205 proper divisor sum: 2241
 2835 proper divisor sum: 2973
 3465 proper divisor sum: 4023
 4095 proper divisor sum: 4513
 4725 proper divisor sum: 5195
 5355 proper divisor sum: 5877
 5775 proper divisor sum: 5977
 5985 proper divisor sum: 6495
 6435 proper divisor sum: 6669
 6615 proper divisor sum: 7065
 6825 proper divisor sum: 7063
 7245 proper divisor sum: 7731
 7425 proper divisor sum: 7455
 7875 proper divisor sum: 8349
 8085 proper divisor sum: 8331
 8415 proper divisor sum: 8433
 8505 proper divisor sum: 8967
 8925 proper divisor sum: 8931
 9135 proper divisor sum: 9585
 9555 proper divisor sum: 9597
 9765 proper divisor sum: 10203
10395 proper divisor sum: 12645
11025 proper divisor sum: 11946

1000th abundant odd number:
     492975  proper divisor sum:  519361

First abundant odd number > 1 000 000 000:
     1000000575  proper divisor sum:  1083561009

Functional[edit]

'''Odd abundant numbers'''

from math import sqrt
from itertools import chain, count, islice


# abundantTuple :: Int -> [(Int, Int)]
def abundantTuple(n):
    '''A list containing the tuple of N and its divisor
       sum, if n is abundant, or an empty list.
    '''
    x = divisorSum(n)
    return [(n, x)] if n < x else []


#  divisorSum :: Int -> Int
def divisorSum(n):
    '''Sum of the divisors of n.'''
    floatRoot = sqrt(n)
    intRoot = int(floatRoot)
    blnSquare = intRoot == floatRoot
    lows = [x for x in range(1, 1 + intRoot) if 0 == n % x]
    return sum(lows + [
        n // x for x in (
            lows[1:-1] if blnSquare else lows[1:]
        )
    ])


# TEST ----------------------------------------------------
# main :: IO ()
def main():
    '''Subsets of abundant odd numbers.'''

    # First 25.
    print('First 25 abundant odd numbers with their divisor sums:')
    for x in take(25)(
            concatMap(abundantTuple)(
                enumFromThen(1)(3)
            )
    ):
        print(x)

    # The 1000th.
    print('\n1000th odd abundant number with its divisor sum:')
    print(
        take(1000)(
            concatMap(abundantTuple)(
                enumFromThen(1)(3)
            )
        )[-1]
    )

    # First over 10^9.
    print('\nFirst odd abundant number over 10^9, with its divisor sum:')
    billion = (10 ** 9)
    print(
        take(1)(
            concatMap(abundantTuple)(
                enumFromThen(1 + billion)(3 + billion)
            )
        )[0]
    )


# GENERAL FUNCTIONS ---------------------------------------

# enumFromThen :: Int -> Int -> [Int]
def enumFromThen(m):
    '''A non-finite stream of integers
       starting at m, and continuing
       at the interval between m and n.
    '''
    return lambda n: count(m, n - m)


# concatMap :: (a -> [b]) -> [a] -> [b]
def concatMap(f):
    '''A concatenated list over which a function f
       has been mapped.
       The list monad can be derived by using an (a -> [b])
       function which wraps its output in a list (using an
       empty list to represent computational failure).
    '''
    return lambda xs: (
        chain.from_iterable(map(f, xs))
    )


# take :: Int -> [a] -> [a]
def take(n):
    '''The prefix of xs of length n,
       or xs itself if n > length xs.
    '''
    return lambda xs: (
        list(islice(xs, n))
    )


if __name__ == '__main__':
    main()
Output:
First 25 abundant odd numbers with their divisor sums:
(945, 975)
(1575, 1649)
(2205, 2241)
(2835, 2973)
(3465, 4023)
(4095, 4641)
(4725, 5195)
(5355, 5877)
(5775, 6129)
(5985, 6495)
(6435, 6669)
(6615, 7065)
(6825, 7063)
(7245, 7731)
(7425, 7455)
(7875, 8349)
(8085, 8331)
(8415, 8433)
(8505, 8967)
(8925, 8931)
(9135, 9585)
(9555, 9597)
(9765, 10203)
(10395, 12645)
(11025, 11946)

1000th odd abundant number with its divisor sum:
(492975, 519361)

First odd abundant number over 10^9, with its divisor sum:
(1000000575, 1083561009)

q[edit]

s:{c where 0=x mod c:1+til x div 2}            / proper divisors
sd:sum s@                                      / sum of proper divisors
abundant:{x<sd x}
Filter:{y where x each y}

Solution largely follows that for #J, except the crucial definition of s. The definition here is naïve. It suffices for the first two items in this task, but takes minutes to execute the third item on a 2018 Mac with 64GB memory.

Output:
q)count A:Filter[abundant] 1+2*til 260000      / a batch of abundant odd numbers; 1000+ is enough
1054

q)1 sd'\25#A                                   / first 25 abundant odd numbers, and the sum of their divisors
945 1575 2205 2835 3465 4095 4725 5355 5775 5985 6435 6615 6825 7245 7425 7875 8085 8415 8505 8925 9135 9555 9765  10395 11025
975 1649 2241 2973 4023 4641 5195 5877 6129 6495 6669 7065 7063 7731 7455 8349 8331 8433 8967 8931 9585 9597 10203 12645 11946

q)1 sd\A 999                                   / 1000th abundant odd number and the sum of its divisors
492975 519361

q)1 sd\(not abundant@)(2+)/1000000000-1        / first abundant odd number above 1,000,000,000 and its divisors
1000000575 1083561009

References:

Quackery[edit]

factors is defined at Factors of an integer#Quackery.

 [ 0 swap factors witheach + ] is sigmasum ( n --> n )

  0 -1 [ 2 + 
         dup sigmasum
         over 2 * over < iff
           [ over echo sp 
             echo cr  
             dip 1+ ]
         else drop 
         over 25 = until ]
  2drop
  cr 
  0 -1 
  [ 2 + dup sigmasum
    over 2 * > if [ dip 1+ ]
    over 1000 = until ]
  dup echo sp sigmasum echo cr 
  drop
  cr
  999999999
  [ 2 + dup sigmasum
    over 2 * > until ] 
  dup echo sp sigmasum echo cr
Output:
945 1920
1575 3224
2205 4446
2835 5808
3465 7488
4095 8736
4725 9920
5355 11232
5775 11904
5985 12480
6435 13104
6615 13680
6825 13888
7245 14976
7425 14880
7875 16224
8085 16416
8415 16848
8505 17472
8925 17856
9135 18720
9555 19152
9765 19968
10395 23040
11025 22971

492975 1012336

1000000575 2083561584

R[edit]

# Abundant Odd Numbers

find_div_sum <- function(x){
  # Finds sigma: the sum of the divisors (not including the number itself) of an odd number
  if (x < 16) return(0)
  root <- sqrt(x)
  vec <- as.vector(1)
  for (i in seq.int(3, root - 1, by = 2)){
    if(x %% i == 0){
      vec <- c(vec, i, x/i)
    }
  }
  if (root == trunc(root)) vec = c(vec, root)
  return(sum(vec))
}

get_n_abun <- function(index = 1, total = 25, print_all = TRUE){
  # Finds a total of 'total' abundant odds starting with 'index', with print option
  n <- 1
  while(n <= total){
    my_sum <- find_div_sum(index)
    if (my_sum > index){
      if(print_all) cat(index, "..... sigma is", my_sum, "\n")
      n <- n + 1
    }
    index <- index + 2
  }
  if(!print_all) cat(index - 2, "..... sigma is", my_sum, "\n")
}

# Get first 25
cat("The first 25 abundants are")
get_n_abun()

# Get the 1000th
cat("The 1000th odd abundant is")
get_n_abun(total = 1000, print_all = F)

# Get the first after 1e9
cat("First odd abundant after 1e9 is")
get_n_abun(index = 1e9 + 1, total = 1, print_all = F)
Output:
The first 25 abundants are
945 ..... sigma is 975 
1575 ..... sigma is 1649 
2205 ..... sigma is 2241 
2835 ..... sigma is 2973 
3465 ..... sigma is 4023 
4095 ..... sigma is 4513 
4725 ..... sigma is 5195 
5355 ..... sigma is 5877 
5775 ..... sigma is 5977 
5985 ..... sigma is 6495 
6435 ..... sigma is 6669 
6615 ..... sigma is 7065 
6825 ..... sigma is 7063 
7245 ..... sigma is 7731 
7425 ..... sigma is 7455 
7875 ..... sigma is 8349 
8085 ..... sigma is 8331 
8415 ..... sigma is 8433 
8505 ..... sigma is 8967 
8925 ..... sigma is 8931 
9135 ..... sigma is 9585 
9555 ..... sigma is 9597 
9765 ..... sigma is 10203 
10395 ..... sigma is 12645 
11025 ..... sigma is 11946 

The 1000th odd abundant is
492975 ..... sigma is 519361 

First odd abundant after 1e9 is
1000000575 ..... sigma is 1083561009

Racket[edit]

#lang racket

(require math/number-theory
         racket/generator)

(define (make-generator start)
  (in-generator
   (for ([n (in-naturals start)] #:when (odd? n))
     (define divisor-sum (- (apply + (divisors n)) n))
     (when (> divisor-sum n) (yield (list n divisor-sum))))))

(for/list ([i (in-range 25)] [x (make-generator 0)]) x) ; Task 1
(for/last ([i (in-range 1000)] [x (make-generator 0)]) x) ; Task 2
(for/first ([x (make-generator (add1 (inexact->exact 1e9)))]) x) ; Task 3
Output:
'((945 975)
  (1575 1649)
  (2205 2241)
  (2835 2973)
  (3465 4023)
  (4095 4641)
  (4725 5195)
  (5355 5877)
  (5775 6129)
  (5985 6495)
  (6435 6669)
  (6615 7065)
  (6825 7063)
  (7245 7731)
  (7425 7455)
  (7875 8349)
  (8085 8331)
  (8415 8433)
  (8505 8967)
  (8925 8931)
  (9135 9585)
  (9555 9597)
  (9765 10203)
  (10395 12645)
  (11025 11946))
'(492975 519361)
'(1000000575 1083561009)

Raku[edit]

(formerly Perl 6)

Works with: Rakudo version 2019.03
sub odd-abundant (\x) {
    my @l = x.is-prime ?? 1 !! flat
    1, (3 .. x.sqrt.floor).map: -> \d {
         next unless d +& 1;
         my \y = x div d;
         next if y * d !== x;
         d !== y ?? (d, y) !! d
    };
    @l.sum > x ?? @l.sort !! Empty;
}

sub odd-abundants (Int :$start-at is copy) {
    $start-at = ( $start-at + 2 ) div 3;
    $start-at += $start-at %% 2;
    $start-at *= 3;
    ($start-at, *+6 ... *).hyper.map: {
        next unless my $oa = cache .&odd-abundant;
        sprintf "%6d: divisor sum: {$oa.join: ' + '} = {$oa.sum}", $_
    }
}

put 'First 25 abundant odd numbers:';
.put for odd-abundants( :start-at(1) )[^25];

put "\nOne thousandth abundant odd number:\n" ~ odd-abundants( :start-at(1) )[999] ~

"\n\nFirst abundant odd number above one billion:\n" ~ odd-abundants( :start-at(1_000_000_000) ).head;
Output:
First 25 abundant odd numbers:
   945: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
  1575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
  2205: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
  2835: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
  3465: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
  4095: divisor sum: 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
  4725: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
  5355: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
  5775: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
  5985: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
  6435: divisor sum: 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
  6615: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
  6825: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
  7245: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
  7425: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
  7875: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
  8085: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
  8415: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
  8505: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
  8925: divisor sum: 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
  9135: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
  9555: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
  9765: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
 10395: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
 11025: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

One thousandth abundant odd number:
492975: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

First abundant odd number above one billion:
1000000575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

REXX[edit]

A wee bit of coding was added to add commas to numbers (because of the larger numbers) as well as alignment of the output.

The   sigO   function is a specialized version of the   sigma   function optimized just for   odd   numbers.

/*REXX pgm displays abundant odd numbers:  1st 25,  one─thousandth,  first > 1 billion. */
parse arg Nlow Nuno Novr .                       /*obtain optional arguments from the CL*/
if Nlow=='' | Nlow==","  then Nlow=          25  /*Not specified?  Then use the default.*/
if Nuno=='' | Nuno==","  then Nuno=        1000  /* "      "         "   "   "     "    */
if Novr=='' | Novr==","  then Novr=  1000000000  /* "      "         "   "   "     "    */
numeric digits max(9, length(Novr) )             /*ensure enough decimal digits for  // */
@= 'odd abundant number'                         /*variable for annotating the output.  */
#= 0                                             /*count of odd abundant numbers so far.*/
      do j=3  by 2  until #>=Nlow;   $= sigO(j)  /*get the  sigma  for an odd integer.  */
      if $<=j  then iterate                      /*sigma  ≤  J ?    Then ignore it.     */
      #= # + 1                                   /*bump the counter for abundant odd #'s*/
      say rt(th(#))     @      'is:'rt(commas(j), 8)     rt("sigma=")     rt(commas($), 9)
      end  /*j*/
say
#= 0                                             /*count of odd abundant numbers so far.*/
      do j=3  by 2;                  $= sigO(j)  /*get the  sigma  for an odd integer.  */
      if $<=j    then iterate                    /*sigma  ≤  J ?    Then ignore it.     */
      #= # + 1                                   /*bump the counter for abundant odd #'s*/
      if #<Nuno  then iterate                    /*Odd abundant# count<Nuno?  Then skip.*/
      say rt(th(#))     @      'is:'rt(commas(j), 8)     rt("sigma=")     rt(commas($), 9)
      leave                                      /*we're finished displaying NUNOth num.*/
      end  /*j*/
say
      do j=1+Novr%2*2  by 2;         $= sigO(j)  /*get sigma for an odd integer > Novr. */
      if $<=j    then iterate                    /*sigma  ≤  J ?    Then ignore it.     */
      say rt(th(1))   @  'over'  commas(Novr)  "is: "   commas(j)  rt('sigma=')  commas($)
      leave                                      /*we're finished displaying NOVRth num.*/
      end  /*j*/
exit                                             /*stick a fork in it,  we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas:parse arg _;  do c_=length(_)-3  to 1  by -3; _=insert(',', _, c_);  end;  return _
rt:    procedure;  parse arg #,len;     if len==''  then len= 20;     return right(#, len)
th:    parse arg th; return th||word('th st nd rd',1+(th//10)*(th//100%10\==1)*(th//10<4))
/*──────────────────────────────────────────────────────────────────────────────────────*/
sigO:  parse arg x;            s= 1              /*sigma for odd integers.           ___*/
             do k=3  by 2  while k*k<x           /*divide by all odd integers up to √ x */
             if x//k==0  then  s= s + k + x%k    /*add the two divisors to (sigma) sum. */
             end   /*k*/                         /*                                  ___*/
       if k*k==x  then  return s + k             /*Was  X  a square?    If so, add  √ x */
                        return s                 /*return (sigma) sum of the divisors.  */
output   when using the default input:
                 1st odd abundant number is:     945               sigma=       975
                 2nd odd abundant number is:   1,575               sigma=     1,649
                 3rd odd abundant number is:   2,205               sigma=     2,241
                 4th odd abundant number is:   2,835               sigma=     2,973
                 5th odd abundant number is:   3,465               sigma=     4,023
                 6th odd abundant number is:   4,095               sigma=     4,641
                 7th odd abundant number is:   4,725               sigma=     5,195
                 8th odd abundant number is:   5,355               sigma=     5,877
                 9th odd abundant number is:   5,775               sigma=     6,129
                10th odd abundant number is:   5,985               sigma=     6,495
                11th odd abundant number is:   6,435               sigma=     6,669
                12th odd abundant number is:   6,615               sigma=     7,065
                13th odd abundant number is:   6,825               sigma=     7,063
                14th odd abundant number is:   7,245               sigma=     7,731
                15th odd abundant number is:   7,425               sigma=     7,455
                16th odd abundant number is:   7,875               sigma=     8,349
                17th odd abundant number is:   8,085               sigma=     8,331
                18th odd abundant number is:   8,415               sigma=     8,433
                19th odd abundant number is:   8,505               sigma=     8,967
                20th odd abundant number is:   8,925               sigma=     8,931
                21st odd abundant number is:   9,135               sigma=     9,585
                22nd odd abundant number is:   9,555               sigma=     9,597
                23rd odd abundant number is:   9,765               sigma=    10,203
                24th odd abundant number is:  10,395               sigma=    12,645
                25th odd abundant number is:  11,025               sigma=    11,946

              1000th odd abundant number is: 492,975               sigma=   519,361

                 1st odd abundant number over 1,000,000,000 is:  1,000,000,575               sigma= 1,083,561,009

Ring[edit]

#Project: Anbundant odd numbers

max = 100000000
limit = 25
nr = 0
m = 1
check = 0
index = 0
see "working..." + nl
see "wait for done..." + nl
while true
      check = 0
      if m%2 = 1
         nice(m)
      ok
      if check = 1
         nr = nr + 1
      ok
      if nr = max
         exit
      ok
      m = m + 1
end
see "done..." + nl

func nice(n)
     check = 0
     nArray = []
     for i = 1 to n - 1
         if n % i = 0
            add(nArray,i)
         ok
     next
     sum = 0
     for p = 1 to len(nArray)
         sum = sum + nArray[p]
     next
     if sum > n
        check = 1
        index = index + 1
        if index < limit + 1
           showArray(n,nArray,sum,index)
        ok
        if index = 100
           see "One thousandth abundant odd number:" + nl
           showArray2(n,nArray,sum,index)
        ok
        if index = 100000000
           see "First abundant odd number above one billion:" + nl
           showArray2(n,nArray,sum,index)
        ok
     ok

func showArray(n,nArray,sum,index)
        see "" + index + ". " + string(n) + ": divisor sum: " 
        for m = 1 to len(nArray)
            if m < len(nArray)
               see string(nArray[m]) + " + "
            else
               see string(nArray[m]) + " = " + string(sum) + nl + nl
            ok
        next

func showArray2(n,nArray,sum,index)
        see "" + index + ". " + string(n) + ": divisor sum: " + 
        see string(nArray[m]) + " = " + string(sum) + nl + nl
working...
wait for done...
1. 945: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975

2. 1575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649

3. 2205: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241

4. 2835: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973

5. 3465: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023

6. 4095: divisor sum: 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641

7. 4725: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195

8. 5355: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877

9. 5775: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129

10. 5985: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495

11. 6435: divisor sum: 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669

12. 6615: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065

13. 6825: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063

14. 7245: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731

15. 7425: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455

16. 7875: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349

17. 8085: divisor sum: 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331

18. 8415: divisor sum: 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433

19. 8505: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967

20. 8925: divisor sum: 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931

21. 9135: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585

22. 9555: divisor sum: 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597

23. 9765: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203

24. 10395: divisor sum: 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645

25. 11025: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

One thousandth abundant odd number:
1000. 492975: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

First abundant odd number above one billion:
100000000. 1000000575: divisor sum: 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009
done...

Ruby[edit]

proper_divisors method taken from http://rosettacode.org/wiki/Proper_divisors#Ruby

require "prime"
 
class Integer
  def proper_divisors
    return [] if self == 1
    primes = prime_division.flat_map{|prime, freq| [prime] * freq}
    (1...primes.size).each_with_object([1]) do |n, res|
      primes.combination(n).map{|combi| res << combi.inject(:*)}
    end.flatten.uniq
  end
end

def generator_odd_abundants(from=1)
  from += 1 if from.even?
  Enumerator.new do |y|
    from.step(nil, 2) do |n|
      sum = n.proper_divisors.sum
      y << [n, sum] if sum > n
    end
  end
end

generator_odd_abundants.take(25).each{|n, sum| puts "#{n} with sum #{sum}" }
puts "\n%d with sum %#d" % generator_odd_abundants.take(1000).last 
puts "\n%d with sum %#d" % generator_odd_abundants(1_000_000_000).next

Rust[edit]

Translation of: Go
fn divisors(n: u64) -> Vec<u64> {
    let mut divs = vec![1];
    let mut divs2 = Vec::new();

    for i in (2..).take_while(|x| x * x <= n).filter(|x| n % x == 0) {
        divs.push(i);
        let j = n / i;
        if i != j {
            divs2.push(j);
        }
    }
    divs.extend(divs2.iter().rev());

    divs
}

fn sum_string(v: Vec<u64>) -> String {
    v[1..]
        .iter()
        .fold(format!("{}", v[0]), |s, i| format!("{} + {}", s, i))
}

fn abundant_odd(search_from: u64, count_from: u64, count_to: u64, print_one: bool) -> u64 {
    let mut count = count_from;
    for n in (search_from..).step_by(2) {
        let divs = divisors(n);
        let total: u64 = divs.iter().sum();
        if total > n {
            count += 1;
            let s = sum_string(divs);
            if !print_one {
                println!("{}. {} < {} = {}", count, n, s, total);
            } else if count == count_to {
                println!("{} < {} = {}", n, s, total);
            }
        }
        if count == count_to {
            break;
        }
    }
    count_to
}

fn main() {
    let max = 25;
    println!("The first {} abundant odd numbers are:", max);
    let n = abundant_odd(1, 0, max, false);

    println!("The one thousandth abundant odd number is:");
    abundant_odd(n, 25, 1000, true);

    println!("The first abundant odd number above one billion is:");
    abundant_odd(1e9 as u64 + 1, 0, 1, true);
}
Output:
The first 25 abundant odd numbers are:
1. 945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
2. 1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
3. 2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
4. 2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
5. 3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
6. 4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
7. 4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
8. 5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
9. 5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10. 5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11. 6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12. 6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13. 6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14. 7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15. 7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16. 7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17. 8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18. 8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19. 8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20. 8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21. 9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22. 9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23. 9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946
The one thousandth abundant odd number is:
479115 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 27 + 35 + 39 + 45 + 63 + 65 + 81 + 91 + 105 + 117 + 135 + 169 + 189 + 195 + 273 + 315 + 351 + 405 + 455 + 507 + 567 + 585 + 819 + 845 + 945 + 1053 + 1183 + 1365 + 1521 + 1755 + 2457 + 2535 + 2835 + 3549 + 4095 + 4563 + 5265 + 5915 + 7371 + 7605 + 10647 + 12285 + 13689 + 17745 + 22815 + 31941 + 36855 + 53235 + 68445 + 95823 + 159705 = 583749
The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Scala[edit]

Translation of: D
import scala.collection.mutable.ListBuffer

object Abundant {
  def divisors(n: Int): ListBuffer[Int] = {
    val divs = new ListBuffer[Int]
    divs.append(1)

    val divs2 = new ListBuffer[Int]
    var i = 2

    while (i * i <= n) {
      if (n % i == 0) {
        val j = n / i
        divs.append(i)
        if (i != j) {
          divs2.append(j)
        }
      }
      i += 1
    }

    divs.appendAll(divs2.reverse)
    divs
  }

  def abundantOdd(searchFrom: Int, countFrom: Int, countTo: Int, printOne: Boolean): Int = {
    var count = countFrom
    var n = searchFrom
    while (count < countTo) {
      val divs = divisors(n)
      val tot = divs.sum
      if (tot > n) {
        count += 1
        if (!printOne || !(count < countTo)) {
          val s = divs.map(a => a.toString).mkString(" + ")
          if (printOne) {
            printf("%d < %s = %d\n", n, s, tot)
          } else {
            printf("%2d. %5d < %s = %d\n", count, n, s, tot)
          }
        }
      }
      n += 2
    }

    n
  }

  def main(args: Array[String]): Unit = {
    val max = 25
    printf("The first %d abundant odd numbers are:\n", max)
    val n = abundantOdd(1, 0, max, printOne = false)

    printf("\nThe one thousandth abundant odd number is:\n")
    abundantOdd(n, 25, 1000, printOne = true)

    printf("\nThe first abundant odd number above one billion is:\n")
    abundantOdd((1e9 + 1).intValue(), 0, 1, printOne = true)
  }
}
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

Sidef[edit]

func is_abundant(n) {
    n.sigma > 2*n
}

func odd_abundants (from = 1) {
     from =  (from + 2)//3
     from += (from%2 - 1)
     3*from .. Inf `by` 6 -> lazy.grep(is_abundant)
}

say         " Index |      Number | proper divisor sum"
const sep = "-------+-------------+-------------------\n"
const fstr = "%6s | %11s | %11s\n"

print sep

odd_abundants().first(25).each_kv {|k,n|
    printf(fstr, k+1, n, n.sigma-n)
}

with (odd_abundants().nth(1000)) {|n|
    printf(sep + fstr, 1000, n, n.sigma-n)
}

with(odd_abundants(1e9).first) {|n|
    printf(sep + fstr, '***', n, n.sigma-n)
}
Output:
 Index |      Number | proper divisor sum
-------+-------------+-------------------
     1 |         945 |         975
     2 |        1575 |        1649
     3 |        2205 |        2241
     4 |        2835 |        2973
     5 |        3465 |        4023
     6 |        4095 |        4641
     7 |        4725 |        5195
     8 |        5355 |        5877
     9 |        5775 |        6129
    10 |        5985 |        6495
    11 |        6435 |        6669
    12 |        6615 |        7065
    13 |        6825 |        7063
    14 |        7245 |        7731
    15 |        7425 |        7455
    16 |        7875 |        8349
    17 |        8085 |        8331
    18 |        8415 |        8433
    19 |        8505 |        8967
    20 |        8925 |        8931
    21 |        9135 |        9585
    22 |        9555 |        9597
    23 |        9765 |       10203
    24 |       10395 |       12645
    25 |       11025 |       11946
-------+-------------+-------------------
  1000 |      492975 |      519361
-------+-------------+-------------------
   *** |  1000000575 |  1083561009

Smalltalk[edit]

divisors := 
    [:nr |
        |divs|

        divs := Set with:1.
        "no need to check even factors; we are only looking for odd nrs"
        3 to:(nr integerSqrt) by:2 do:[:d | nr % d = 0 ifTrue:[divs add:d; add:(nr / d)]].
        divs.
    ].

isAbundant := [:nr | (divisors value:nr) sum > nr].

"from set of abdundant numbers >= minNr, print nMinPrint-th to nMaxPrint-th"
printNAbundant := 
    [:minNr :nMinPrint :nMaxPrint |
        |count divs|

        count := 0.
        minNr to:Infinity positive doWithExit:[:nr :exit |
            (nr odd and:[isAbundant value:nr]) ifTrue:[
                count := count + 1.
                count >= nMinPrint ifTrue:[
                    divs := divisors value:nr.
                    Transcript
                        show:nr; show:' -> '; show:divs asArray sorted;
                        show:' sum = '; showCR:divs sum.
                ].
                count >= nMaxPrint ifTrue: exit
            ]
        ]
    ].

Transcript showCR:'first 25 odd abundant numbers:'.
"from set of abdundant numbers >= 3, print 1st to 25th"
printNAbundant value:3 value:1 value:25.                

Transcript cr; showCR:'first odd abundant number above 1000000000:'.
"from set of abdundant numbers >= 1000000000, print 1st to 1st"
printNAbundant value:1000000000 value:1 value:1.        

Transcript cr; showCR:'first odd abundant number above 1000000000000:'.
"from set of abdundant numbers >= 1000000000, print 1st to 1st"
printNAbundant value:1000000000000 value:1 value:1.        

Transcript cr; showCR:'the 1000th odd abundant number is:'.
"from set of abdundant numbers>= 3, print 1000th to 1000th"
printNAbundant value:3 value:1000 value:1000.
Output:
first 25 odd abundant numbers:
945 -> #(1 3 5 7 9 15 21 27 35 45 63 105 135 189 315) sum = 975
1575 -> #(1 3 5 7 9 15 21 25 35 45 63 75 105 175 225 315 525) sum = 1649
2205 -> #(1 3 5 7 9 15 21 35 45 49 63 105 147 245 315 441 735) sum = 2241
2835 -> #(1 3 5 7 9 15 21 27 35 45 63 81 105 135 189 315 405 567 945) sum = 2973
3465 -> #(1 3 5 7 9 11 15 21 33 35 45 55 63 77 99 105 165 231 315 385 495 693 1155) sum = 4023
4095 -> #(1 3 5 7 9 13 15 21 35 39 45 63 65 91 105 117 195 273 315 455 585 819 1365) sum = 4641
4725 -> #(1 3 5 7 9 15 21 25 27 35 45 63 75 105 135 175 189 225 315 525 675 945 1575) sum = 5195
5355 -> #(1 3 5 7 9 15 17 21 35 45 51 63 85 105 119 153 255 315 357 595 765 1071 1785) sum = 5877
5775 -> #(1 3 5 7 11 15 21 25 33 35 55 75 77 105 165 175 231 275 385 525 825 1155 1925) sum = 6129
5985 -> #(1 3 5 7 9 15 19 21 35 45 57 63 95 105 133 171 285 315 399 665 855 1197 1995) sum = 6495
6435 -> #(1 3 5 9 11 13 15 33 39 45 55 65 99 117 143 165 195 429 495 585 715 1287 2145) sum = 6669
6615 -> #(1 3 5 7 9 15 21 27 35 45 49 63 105 135 147 189 245 315 441 735 945 1323 2205) sum = 7065
6825 -> #(1 3 5 7 13 15 21 25 35 39 65 75 91 105 175 195 273 325 455 525 975 1365 2275) sum = 7063
7245 -> #(1 3 5 7 9 15 21 23 35 45 63 69 105 115 161 207 315 345 483 805 1035 1449 2415) sum = 7731
7425 -> #(1 3 5 9 11 15 25 27 33 45 55 75 99 135 165 225 275 297 495 675 825 1485 2475) sum = 7455
7875 -> #(1 3 5 7 9 15 21 25 35 45 63 75 105 125 175 225 315 375 525 875 1125 1575 2625) sum = 8349
8085 -> #(1 3 5 7 11 15 21 33 35 49 55 77 105 147 165 231 245 385 539 735 1155 1617 2695) sum = 8331
8415 -> #(1 3 5 9 11 15 17 33 45 51 55 85 99 153 165 187 255 495 561 765 935 1683 2805) sum = 8433
8505 -> #(1 3 5 7 9 15 21 27 35 45 63 81 105 135 189 243 315 405 567 945 1215 1701 2835) sum = 8967
8925 -> #(1 3 5 7 15 17 21 25 35 51 75 85 105 119 175 255 357 425 525 595 1275 1785 2975) sum = 8931
9135 -> #(1 3 5 7 9 15 21 29 35 45 63 87 105 145 203 261 315 435 609 1015 1305 1827 3045) sum = 9585
9555 -> #(1 3 5 7 13 15 21 35 39 49 65 91 105 147 195 245 273 455 637 735 1365 1911 3185) sum = 9597
9765 -> #(1 3 5 7 9 15 21 31 35 45 63 93 105 155 217 279 315 465 651 1085 1395 1953 3255) sum = 10203
10395 -> #(1 3 5 7 9 11 15 21 27 33 35 45 55 63 77 99 105 135 165 189 231 297 315 385 495 693 945 1155 1485 2079 3465) sum = 12645
11025 -> #(1 3 5 7 9 15 21 25 35 45 49 63 75 105 147 175 225 245 315 441 525 735 1225 1575 2205 3675) sum = 11946

first odd abundant number above 1000000000:
1000000575 -> #(1 3 5 7 9 15 21 25 35 45 49 63 75 105 147 175 225 245 315 441 525 735 1225 1575 2205 3675 11025 90703 272109 453515 634921 816327 1360545 1904763 2267575 3174605 4081635 4444447 5714289 6802725 9523815 13333341 15873025 20408175 22222235 28571445 40000023 47619075 66666705 111111175 142857225 200000115 333333525) sum = 1083561009

first odd abundant number above 1000000000000:
1000000000125 -> #(1 3 5 7 9 15 21 23 25 29 35 45 61 63 69 75 87 105 115 125 145 161 175 183 203 207 225 261 305 315 345 375 427 435 483 525 549 575 609 667 725 805 875 915 1015 1035 1125 1281 1305 1403 1449 1525 1575 1725 1769 1827 2001 2135 2175 2415 2625 2745 2875 3045 3121 3335 3625 3843 4025 4209 4575 4669 5075 5175 5307 6003 6405 6525 7015 7245 7625 7875 8625 8845 9135 9363 9821 10005 10675 10875 12075 12383 12627 13725 14007 15225 15605 15921 16675 19215 20125 21045 21847 22875 23345 25375 25875 26535 28089 29463 30015 32025 32625 35075 36225 37149 40687 42021 44225 45675 46815 49105 50025 53375 60375 61915 63135 65541 68625 70035 71783 76125 78025 79605 83375 88389 90509 96075 105225 109235 111447 116725 122061 132675 140445 147315 150075 160125 175375 181125 185745 190381 196623 203435 210105 215349 221125 228375 234075 245525 250125 271527 284809 309575 315675 327705 350175 358915 366183 390125 398025 441945 452545 480375 502481 526125 546175 557235 571143 583625 610305 633563 646047 663375 702225 736575 750375 814581 854427 928725 951905 983115 1017175 1050525 1076745 1170375 1227625 1332667 1357635 1424045 1507443 1547875 1578375 1638525 1713429 1750875 1794575 1830915 1900689 1990125 2081707 2209725 2262725 2512405 2563281 2730875 2786175 2855715 3051525 3167815 3230235 3511125 3682875 3998001 4072905 4272135 4378763 4522329 4643625 4759525 4915575 5085875 5252625 5383725 5521049 5702067 6245121 6663335 6788175 7120225 7537215 8192625 8567145 8972875 9154575 9503445 10408535 11048625 11313625 11994003 12562025 12816405 13136289 13930875 14278575 14571949 15257625 15839075 16151175 16563147 18735363 19990005 20364525 21360675 21893815 22611645 23797625 24577875 26918625 27605245 28510335 30651341 31225605 33316675 33940875 35601125 37686075 38647343 39408867 42835725 43715847 45772875 47517225 49689441 52042675 59970015 62810125 64082025 65681445 71392875 72859745 79195375 80755875 82815735 91954023 93676815 99950025 101822625 106803375 109469075 113058225 115942029 126984127 131147541 138026225 142551675 153256705 156128025 166583375 188430375 193236715 197044335 214178625 218579235 237586125 248447205 260213375 275862069 299850075 320410125 328407225 347826087 364298725 380952381 414078675 459770115 468384075 499750125 547345375 565291125 579710145 634920635 655737705 690131125 712758375 766283525 780640125 888888889 966183575 985221675 1092896175 1142857143 1242236025 1379310345 1499250375 1642036125 1739130435 1821493625 1904761905 2070393375 2298850575 2341920375 2666666667 2898550725 3174603175 3278688525 3831417625 4444444445 4830917875 4926108375 5464480875 5714285715 6211180125 6896551725 8000000001 8695652175 9523809525 11494252875 13333333335 14492753625 15873015875 16393442625 22222222225 28571428575 34482758625 40000000005 43478260875 47619047625 66666666675 111111111125 142857142875 200000000025 333333333375) sum = 1261075281795

the 1000th odd abundant number is:
492975 -> #(1 3 5 7 9 15 21 25 35 45 63 75 105 175 225 313 315 525 939 1565 1575 2191 2817 4695 6573 7825 10955 14085 19719 23475 32865 54775 70425 98595 164325) sum = 519361

Swift[edit]

extension BinaryInteger {
  @inlinable
  public func factors(sorted: Bool = true) -> [Self] {
    let maxN = Self(Double(self).squareRoot())
    var res = Set<Self>()

    for factor in stride(from: 1, through: maxN, by: 1) where self % factor == 0 {
      res.insert(factor)
      res.insert(self / factor)
    }

    return sorted ? res.sorted() : Array(res)
  }
}

@inlinable
public func isAbundant<T: BinaryInteger>(n: T) -> (Bool, [T]) {
  let divs = n.factors().dropLast()

  return (divs.reduce(0, +) > n, Array(divs))
}

let oddAbundant = (0...).lazy.filter({ $0 & 1 == 1 }).map({ ($0, isAbundant(n: $0)) }).filter({ $1.0 })

for (n, (_, factors)) in oddAbundant.prefix(25) {
  print("n: \(n); sigma: \(factors.reduce(0, +))")
}

let (bigA, (_, bigFactors)) =
  (1_000_000_000...)
    .lazy
    .filter({ $0 & 1 == 1 })
    .map({ ($0, isAbundant(n: $0)) })
    .first(where: { $1.0 })!

print("first odd abundant number over 1 billion: \(bigA), sigma: \(bigFactors.reduce(0, +))")
Output:
n: 945; sigma: 975
n: 1575; sigma: 1649
n: 2205; sigma: 2241
n: 2835; sigma: 2973
n: 3465; sigma: 4023
n: 4095; sigma: 4641
n: 4725; sigma: 5195
n: 5355; sigma: 5877
n: 5775; sigma: 6129
n: 5985; sigma: 6495
n: 6435; sigma: 6669
n: 6615; sigma: 7065
n: 6825; sigma: 7063
n: 7245; sigma: 7731
n: 7425; sigma: 7455
n: 7875; sigma: 8349
n: 8085; sigma: 8331
n: 8415; sigma: 8433
n: 8505; sigma: 8967
n: 8925; sigma: 8931
n: 9135; sigma: 9585
n: 9555; sigma: 9597
n: 9765; sigma: 10203
n: 10395; sigma: 12645
n: 11025; sigma: 11946
first odd abundant number over 1 billion: 1000000575, sigma: 1083561009

uBasic/4tH[edit]

Translation of: C
c = 0
  
For n = 1 Step 2 While c < 25
  If n < FUNC(_SumProperDivisors(n)) Then
    c = c + 1
    Print Using "_#"; c; Using " ____#"; n
  EndIf
Next
  
For n = n Step 2 While c < 1000
  If n < FUNC(_SumProperDivisors(n)) Then c = c + 1
Next
 
Print "\nThe one thousandth abundant odd number is: "; n
 
For n = 1000000001 Step 2 
  Until n < FUNC(_SumProperDivisors(n))
Next
  
Print "The first abundant odd number above one billion is: "; n
End

' The following function is for odd numbers ONLY

_SumProperDivisors
  Param (1)
  Local (3)
  
  b@ = 1
  For c@ = 3 To FUNC(_Sqrt(a@)) Step 2
    If (a@ % c@) = 0 Then b@ = b@ + c@ + Iif (c@ = Set(d@, a@/c@), 0, d@)
  Next
Return (b@)

_Sqrt
  Param (1)
  Local (3)

  Let b@ = 1
  Let c@ = 0

  Do Until b@ > a@
    Let b@ = b@ * 4
  Loop

  Do While b@ > 1
    Let b@ = b@ / 4
    Let d@ = a@ - c@ - b@
    Let c@ = c@ / 2
    If d@ > -1 Then
      Let a@ = d@
      Let c@ = c@ + b@
    Endif
  Loop

Return (c@)
Output:
 1   945
 2  1575
 3  2205
 4  2835
 5  3465
 6  4095
 7  4725
 8  5355
 9  5775
10  5985
11  6435
12  6615
13  6825
14  7245
15  7425
16  7875
17  8085
18  8415
19  8505
20  8925
21  9135
22  9555
23  9765
24 10395
25 11025

The one thousandth abundant odd number is: 492977
The first abundant odd number above one billion is: 1000000575

0 OK, 0:479 

Visual Basic .NET[edit]

Translation of: ALGOL 68
Module AbundantOddNumbers
    ' find some abundant odd numbers - numbers where the sum of the proper
    '                                  divisors is bigger than the number
    '                                  itself

    ' returns the sum of the proper divisors of n
    Private Function divisorSum(n As Integer) As Integer
        Dim sum As Integer = 1
        For d As Integer = 2 To Math.Round(Math.Sqrt(n))
            If n Mod d = 0 Then
                sum += d
                Dim otherD As Integer = n \ d
                IF otherD <> d Then
                    sum += otherD
                End If
            End If
        Next d
        Return sum
    End Function

    ' find numbers required by the task
    Public Sub Main(args() As String)
        ' first 25 odd abundant numbers
        Dim oddNumber As Integer = 1
        Dim aCount As Integer = 0
        Dim dSum As Integer = 0
        Console.Out.WriteLine("The first 25 abundant odd numbers:")
        Do While aCount < 25
            dSum = divisorSum(oddNumber)
            If dSum > oddNumber Then
                aCount += 1
                Console.Out.WriteLine(oddNumber.ToString.PadLeft(6) & " proper divisor sum: " & dSum)
            End If
            oddNumber += 2
        Loop
        ' 1000th odd abundant number
        Do While aCount < 1000
            dSum = divisorSum(oddNumber)
            If dSum > oddNumber Then
                aCount += 1
            End If
            oddNumber += 2
        Loop
        Console.Out.WriteLine("1000th abundant odd number:")
        Console.Out.WriteLine("    " & (oddNumber - 2) & " proper divisor sum: " & dSum)
        ' first odd abundant number > one billion
        oddNumber = 1000000001
        Dim found As Boolean = False
        Do While Not found
            dSum = divisorSum(oddNumber)
            If dSum > oddNumber Then
                found = True
                Console.Out.WriteLine("First abundant odd number > 1 000 000 000:")
                Console.Out.WriteLine("    " & oddNumber & " proper divisor sum: " & dSum)
            End If
            oddNumber += 2
        Loop
    End Sub
End Module
Output:
The first 25 abundant odd numbers:
   945 proper divisor sum: 975
  1575 proper divisor sum: 1649
  2205 proper divisor sum: 2241
  2835 proper divisor sum: 2973
  3465 proper divisor sum: 4023
  4095 proper divisor sum: 4641
  4725 proper divisor sum: 5195
  5355 proper divisor sum: 5877
  5775 proper divisor sum: 6129
  5985 proper divisor sum: 6495
  6435 proper divisor sum: 6669
  6615 proper divisor sum: 7065
  6825 proper divisor sum: 7063
  7245 proper divisor sum: 7731
  7425 proper divisor sum: 7455
  7875 proper divisor sum: 8349
  8085 proper divisor sum: 8331
  8415 proper divisor sum: 8433
  8505 proper divisor sum: 8967
  8925 proper divisor sum: 8931
  9135 proper divisor sum: 9585
  9555 proper divisor sum: 9597
  9765 proper divisor sum: 10203
 10395 proper divisor sum: 12645
 11025 proper divisor sum: 11946
1000th abundant odd number:
    492975 proper divisor sum: 519361
First abundant odd number > 1 000 000 000:
    1000000575 proper divisor sum: 1083561009

Vlang[edit]

Translation of: go
fn divisors(n i64) []i64 {
    mut divs := [i64(1)]
    mut divs2 := []i64{}
    for i := 2; i*i <= n; i++ {
        if n%i == 0 {
            j := n / i
            divs << i
            if i != j {
                divs2 << j
            }
        }
    }
    for i := divs2.len - 1; i >= 0; i-- {
        divs << divs2[i]
    }
    return divs
}
 
fn sum(divs []i64) i64 {
    mut tot := i64(0)
    for div in divs {
        tot += div
    }
    return tot
}
 
fn sum_str(divs []i64) string {
    mut s := ""
    for div in divs {
        s += "${u8(div)} + "
    }
    return s[0..s.len-3]
}
 
fn abundant_odd(search_from i64, count_from int, count_to int, print_one bool) i64 {
    mut count := count_from
    mut n := search_from
    for ; count < count_to; n += 2 {
        divs := divisors(n)
        tot := sum(divs)
        if tot > n {
            count++
            if print_one && count < count_to {
                continue
            }
            s := sum_str(divs)
            if !print_one {
                println("${count:2}. ${n:5} < $s = $tot")
            } else {
                println("$n < $s = $tot")
            }
        }
    }
    return n
}

const max = 25

fn main() {
    println("The first $max abundant odd numbers are:")
    n := abundant_odd(1, 0, 25, false)
 
    println("\nThe one thousandth abundant odd number is:")
    abundant_odd(n, 25, 1000, true)
 
    println("\nThe first abundant odd number above one billion is:")
    abundant_odd(1_000_000_001, 0, 1, true)
}
Output:
Same as Go entry

Wren[edit]

Translation of: Go
Library: Wren-fmt
Library: Wren-math
import "/fmt" for Fmt
import "/math" for Int, Nums
  
var sumStr = Fn.new { |divs| divs.reduce("") { |acc, div| acc + "%(div) + " }[0...-3] }
 
var abundantOdd = Fn.new { |searchFrom, countFrom, countTo, printOne|
    var count = countFrom
    var n = searchFrom
    while (count < countTo) {
        var divs = Int.properDivisors(n)
        var tot = Nums.sum(divs)
        if (tot > n) {
            count = count + 1
            if (!printOne || count >= countTo) {
                var s = sumStr.call(divs)
                if (!printOne) {
                    System.print("%(Fmt.d(2, count)). %(Fmt.d(5, n)) < %(s) = %(tot)")
                } else {
                    System.print("%(n) < %(s) = %(tot)")
                }
            }
        }
        n = n + 2
    }
    return n
}
 
var MAX = 25
System.print("The first %(MAX) abundant odd numbers are:")
var n = abundantOdd.call(1, 0, 25, false)
 
System.print("\nThe one thousandth abundant odd number is:")
abundantOdd.call(n, 25, 1000, true)
 
System.print("\nThe first abundant odd number above one billion is:")
abundantOdd.call(1e9+1, 0, 1, true)
Output:
The first 25 abundant odd numbers are:
 1.   945 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975
 2.  1575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525 = 1649
 3.  2205 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735 = 2241
 4.  2835 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945 = 2973
 5.  3465 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155 = 4023
 6.  4095 < 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365 = 4641
 7.  4725 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575 = 5195
 8.  5355 < 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785 = 5877
 9.  5775 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925 = 6129
10.  5985 < 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995 = 6495
11.  6435 < 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145 = 6669
12.  6615 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205 = 7065
13.  6825 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275 = 7063
14.  7245 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415 = 7731
15.  7425 < 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475 = 7455
16.  7875 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625 = 8349
17.  8085 < 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695 = 8331
18.  8415 < 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805 = 8433
19.  8505 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835 = 8967
20.  8925 < 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975 = 8931
21.  9135 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045 = 9585
22.  9555 < 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185 = 9597
23.  9765 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255 = 10203
24. 10395 < 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465 = 12645
25. 11025 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 = 11946

The one thousandth abundant odd number is:
492975 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325 = 519361

The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009

X86 Assembly[edit]

Assemble with tasm and tlink /t

        .model  tiny
        .code
        .486
        org     100h
;ebp=counter, edi=Num, ebx=Div, esi=Sum
start:  xor     ebp, ebp        ;odd abundant number counter:= 0
        mov     edi, 3          ;Num:= 3
ab10:   mov     ebx, 3          ;Div:= 3
        mov     esi, 1          ;Sum:= 1
ab20:   mov     eax, edi        ;Quot:= Num/Div
        cdq                     ;edx:= 0
        div     ebx             ;eax(q):edx(r):= edx:eax/ebx
        cmp     ebx, eax        ;if Div > Quot then quit loop
        jge     ab50
         test   edx, edx        ;if remainder = 0 then
         jne    ab30
          add   esi, ebx        ;  Sum:= Sum + Div
          cmp   ebx, eax        ;  if Div # Quot then
          je    ab30
          add   esi, eax        ;    Sum:= Sum + Quot
ab30:    add    ebx, 2          ;Div:= Div+2 (only check odd Nums)
         jmp    ab20            ;loop
ab50:
        cmp     esi, edi        ;if Sum > Num then
        jle     ab80
        inc     ebp             ;  counter:= counter+1
        cmp     ebp, 25         ;  if counter<=25 or counter>=1000 then
        jle     ab60
         cmp    ebp, 1000
         jl     ab80
ab60:   mov     eax, edi        ;    print Num
        call    numout
        mov     al, ' '         ;    print spaces
        int     29h
        int     29h
        mov     eax, esi        ;    print Sum
        call    numout
        mov     al, 0Dh         ;    carriage return
        int     29h
        mov     al, 0Ah         ;    line feed
        int     29h
        cmp     ebp, 1000       ;    if counter = 1000 then
        jne     ab65
         mov    edi, 1000000001-2 ;    Num:= 1,000,000,001 - 2
ab65:   cmp     edi, 1000000000 ;      if Num > 1,000,000,000 then exit
        jg      ab90
ab80:   add     edi, 2          ;Num:= Num+2 (only check odd Nums)
        jmp     ab10            ;loop
ab90:   ret

;Print signed integer in eax with commas, e.g: 12,345,010
numout: xor     ecx, ecx        ;digit counter:= 0
no00:   cdq                     ;edx:= 0
        mov     ebx, 10         ;Num:= Num/10
        div     ebx             ;eax(q):edx(r):= edx:eax/ebx
        push    edx             ;remainder = least significant digit
        inc     ecx             ;count digit
        test    eax, eax        ;if Num # 0 then NumOut(Num)
        je      no20
         call   no00
no20:   pop     eax             ;print digit + '0'
        add     al, '0'
        int     29h
        dec     ecx             ;un-count digit
        je      no30            ;if counter # 0 and
         mov    al, cl          ;  if remainder(counter/3) = 0 then
         aam    3
         jne    no30
          mov   al, ','         ;    print ','
          int   29h
no30:   ret
        end     start
Output:
945  975
1,575  1,649
2,205  2,241
2,835  2,973
3,465  4,023
4,095  4,641
4,725  5,195
5,355  5,877
5,775  6,129
5,985  6,495
6,435  6,669
6,615  7,065
6,825  7,063
7,245  7,731
7,425  7,455
7,875  8,349
8,085  8,331
8,415  8,433
8,505  8,967
8,925  8,931
9,135  9,585
9,555  9,597
9,765  10,203
10,395  12,645
11,025  11,946
492,975  519,361
1,000,000,575  1,083,561,009

XPL0[edit]

int Cnt, Num, Div, Sum, Quot;
[Cnt:= 0;
Num:= 3;        \find odd abundant numbers
loop    [Div:= 1;
        Sum:= 0;
        loop    [Quot:= Num/Div;
                if Div > Quot then quit;
                if rem(0) = 0 then
                    [Sum:= Sum + Div;
                    if Div # Quot then Sum:= Sum + Quot;
                    ];
                Div:= Div+2;
                ];
        if Sum > 2*Num then
                [Cnt:= Cnt+1;
                if Cnt<=25 or Cnt>=1000 then
                    [IntOut(0, Num);  ChOut(0, 9);
                    IntOut(0, Sum);  CrLf(0);
                    if Cnt = 1000 then Num:= 1_000_000_001 - 2;
                    if Num > 1_000_000_000 then quit;
                    ];
                ];
        Num:= Num+2;
        ];
]
Output:
945     1920
1575    3224
2205    4446
2835    5808
3465    7488
4095    8736
4725    9920
5355    11232
5775    11904
5985    12480
6435    13104
6615    13680
6825    13888
7245    14976
7425    14880
7875    16224
8085    16416
8415    16848
8505    17472
8925    17856
9135    18720
9555    19152
9765    19968
10395   23040
11025   22971
492975  1012336
1000000575      2083561584

zkl[edit]

fcn oddAbundants(startAt=3){  //--> iterator
   Walker.zero().tweak(fcn(rn){
      n:=rn.value;
      while(True){
	 sum:=0;
	 foreach d in ([3.. n.toFloat().sqrt().toInt(), 2]){
	    if( (y:=n/d) *d != n) continue;
	    sum += ((y==d) and y or y+d)
	 }
	 if(sum>n){ rn.set(n+2); return(n) }
	 n+=2;
      }
   }.fp(Ref(startAt.isOdd and startAt or startAt+1)))
}
fcn oddDivisors(n){  // -->sorted List
   [3.. n.toFloat().sqrt().toInt(), 2].pump(List(1),'wrap(d){
      if( (y:=n/d) *d != n) return(Void.Skip);
      if (y==d) y else T(y,d)
    }).flatten().sort()
}
fcn printOAs(oas){  // List | int
   foreach n in (vm.arglist.flatten()){ 
      ds:=oddDivisors(n);
      println("%6,d: %6,d = %s".fmt(n, ds.sum(0), ds.sort().concat(" + ")))
   }
}
oaw:=oddAbundants();

println("First 25 abundant odd numbers:");
oaw.walk(25) : printOAs(_);

println("\nThe one thousandth abundant odd number is:");
oaw.drop(1_000 - 25).value : printOAs(_);

println("\nThe first abundant odd number above one billion is:");
printOAs(oddAbundants(1_000_000_000).next());
Output:
   945:    975 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315
 1,575:  1,649 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 315 + 525
 2,205:  2,241 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 35 + 45 + 49 + 63 + 105 + 147 + 245 + 315 + 441 + 735
 2,835:  2,973 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 315 + 405 + 567 + 945
 3,465:  4,023 = 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 165 + 231 + 315 + 385 + 495 + 693 + 1155
 4,095:  4,641 = 1 + 3 + 5 + 7 + 9 + 13 + 15 + 21 + 35 + 39 + 45 + 63 + 65 + 91 + 105 + 117 + 195 + 273 + 315 + 455 + 585 + 819 + 1365
 4,725:  5,195 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 27 + 35 + 45 + 63 + 75 + 105 + 135 + 175 + 189 + 225 + 315 + 525 + 675 + 945 + 1575
 5,355:  5,877 = 1 + 3 + 5 + 7 + 9 + 15 + 17 + 21 + 35 + 45 + 51 + 63 + 85 + 105 + 119 + 153 + 255 + 315 + 357 + 595 + 765 + 1071 + 1785
 5,775:  6,129 = 1 + 3 + 5 + 7 + 11 + 15 + 21 + 25 + 33 + 35 + 55 + 75 + 77 + 105 + 165 + 175 + 231 + 275 + 385 + 525 + 825 + 1155 + 1925
 5,985:  6,495 = 1 + 3 + 5 + 7 + 9 + 15 + 19 + 21 + 35 + 45 + 57 + 63 + 95 + 105 + 133 + 171 + 285 + 315 + 399 + 665 + 855 + 1197 + 1995
 6,435:  6,669 = 1 + 3 + 5 + 9 + 11 + 13 + 15 + 33 + 39 + 45 + 55 + 65 + 99 + 117 + 143 + 165 + 195 + 429 + 495 + 585 + 715 + 1287 + 2145
 6,615:  7,065 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 49 + 63 + 105 + 135 + 147 + 189 + 245 + 315 + 441 + 735 + 945 + 1323 + 2205
 6,825:  7,063 = 1 + 3 + 5 + 7 + 13 + 15 + 21 + 25 + 35 + 39 + 65 + 75 + 91 + 105 + 175 + 195 + 273 + 325 + 455 + 525 + 975 + 1365 + 2275
 7,245:  7,731 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 23 + 35 + 45 + 63 + 69 + 105 + 115 + 161 + 207 + 315 + 345 + 483 + 805 + 1035 + 1449 + 2415
 7,425:  7,455 = 1 + 3 + 5 + 9 + 11 + 15 + 25 + 27 + 33 + 45 + 55 + 75 + 99 + 135 + 165 + 225 + 275 + 297 + 495 + 675 + 825 + 1485 + 2475
 7,875:  8,349 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 125 + 175 + 225 + 315 + 375 + 525 + 875 + 1125 + 1575 + 2625
 8,085:  8,331 = 1 + 3 + 5 + 7 + 11 + 15 + 21 + 33 + 35 + 49 + 55 + 77 + 105 + 147 + 165 + 231 + 245 + 385 + 539 + 735 + 1155 + 1617 + 2695
 8,415:  8,433 = 1 + 3 + 5 + 9 + 11 + 15 + 17 + 33 + 45 + 51 + 55 + 85 + 99 + 153 + 165 + 187 + 255 + 495 + 561 + 765 + 935 + 1683 + 2805
 8,505:  8,967 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 81 + 105 + 135 + 189 + 243 + 315 + 405 + 567 + 945 + 1215 + 1701 + 2835
 8,925:  8,931 = 1 + 3 + 5 + 7 + 15 + 17 + 21 + 25 + 35 + 51 + 75 + 85 + 105 + 119 + 175 + 255 + 357 + 425 + 525 + 595 + 1275 + 1785 + 2975
 9,135:  9,585 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 29 + 35 + 45 + 63 + 87 + 105 + 145 + 203 + 261 + 315 + 435 + 609 + 1015 + 1305 + 1827 + 3045
 9,555:  9,597 = 1 + 3 + 5 + 7 + 13 + 15 + 21 + 35 + 39 + 49 + 65 + 91 + 105 + 147 + 195 + 245 + 273 + 455 + 637 + 735 + 1365 + 1911 + 3185
 9,765: 10,203 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 31 + 35 + 45 + 63 + 93 + 105 + 155 + 217 + 279 + 315 + 465 + 651 + 1085 + 1395 + 1953 + 3255
10,395: 12,645 = 1 + 3 + 5 + 7 + 9 + 11 + 15 + 21 + 27 + 33 + 35 + 45 + 55 + 63 + 77 + 99 + 105 + 135 + 165 + 189 + 231 + 297 + 315 + 385 + 495 + 693 + 945 + 1155 + 1485 + 2079 + 3465
11,025: 11,946 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675

The one thousandth abundant odd number is:
492,975: 519,3lang scala>import scala.collection.mutable.ListBuffer

object Abundant {
  def divisors(n: Int): ListBuffer[Int] = {
    val divs = new ListBuffer[Int]
    divs.append(1)

    val divs2 = new ListBuffer[Int]
    var i = 2

    while (i * i 61 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 63 + 75 + 105 + 175 + 225 + 313 + 315 + 525 + 939 + 1565 + 1575 + 2191 + 2817 + 4695 + 6573 + 7825 + 10955 + 14085 + 19719 + 23475 + 32865 + 54775 + 70425 + 98595 + 164325

The first abundant odd number above one billion is:
1,000,000,575: 1,083,561,009 = 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525