Skip to main content
Commonmark migration
Source Link

#Julia - 28#

Julia - 28

By a recursive way:

a(n)=n==1?1:1+a(n-a(a(n-1)))

Output:

[a(i) for i=1:20]'
1x20 Array{Int64,2}:
 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8

#Julia - 28#

By a recursive way:

a(n)=n==1?1:1+a(n-a(a(n-1)))

Output:

[a(i) for i=1:20]'
1x20 Array{Int64,2}:
 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8

Julia - 28

By a recursive way:

a(n)=n==1?1:1+a(n-a(a(n-1)))

Output:

[a(i) for i=1:20]'
1x20 Array{Int64,2}:
 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8
Source Link
CCP
  • 652
  • 5
  • 6

#Julia - 28#

By a recursive way:

a(n)=n==1?1:1+a(n-a(a(n-1)))

Output:

[a(i) for i=1:20]'
1x20 Array{Int64,2}:
 1  2  2  3  3  4  4  4  5  5  5  6  6  6  6  7  7  7  7  8