OFFSET
0,2
COMMENTS
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..5000
National Science Teachers Association, Quantum CyberTeaser Archive #B205, May/June 1997
EXAMPLE
a(4) = 18 = 3 +2 +7 +3 +3 is the time required to cross the bridge for a boy, his sister, his father and his mother if they require 2, 3, 5, 7 minutes, respectively, to cross the bridge individually (using the moves B + G, B, M + F, G, B + G).
MATHEMATICA
Table[A147673[n], {n, 0, 70}] (* G. C. Greubel, Dec 02 2025 *)
PROG
(PARI)
BRIDGE( a )={ local( s=vector(#a), t ); vector( #a, n, t=vecsort( vecextract( a, 2^n-1 )); t[n]+if( n>3, t[1]+2*t[2]+BRIDGE( vecextract( t, 2^(n-2)-1 ))[n-2], if(n==3, t[1]+t[2] ))) }
A147673 = BRIDGE( vector( 20, n, prime(n)))
(PARI)
a=[2, 3, 10]; for( n=4, 90, a=concat(a, a[n-2]+prime(n)+8)); a
(Magma)
A147673:= function(n)
if n le 3 then return Fibonacci(n)*Fibonacci(n+2);
else return $$(n-2) +NthPrime(n) +8;
end if;
end function;
[A147673(n): n in [0..70]]; // G. C. Greubel, Dec 02 2025
(SageMath)
def A147673(n):
if n<4: return (0, 2, 3, 10)[n]
else: return A147673(n-2) +nth_prime(n) +8
print([A147673(n) for n in range(71)]) # G. C. Greubel, Dec 02 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 10 2008
STATUS
approved
